To configure a serializer for your application, you need to choose a backend and then specify any necessary configuration values for it. The following backends are provided out of the box:

Other backends may be provided by other components.

Once you’ve selected a backend, see its specific documentation to find out what configuration values you need to provide, if any. Configuration values are expressed as constructor arguments for the backend class:

    backend: json

This configuration publishes a Serializer resource named default using the JSON backend. The same can be done directly in Python code as follows:

class ApplicationComponent(ContainerComponent):
    async def start(ctx: Context) -> None:
        self.add_component('serialization', backend='json')
        await super().start()

Multiple serializers

If you need to configure multiple serializers, you will need to use multiple instances of the serialization component:

    backend: cbor
    type: serialization
    backend: msgpack
    resource_name: msgpack

The above configuration creates two serializer resources, available under 6 different combinations: