Core supports JSON and XML, as well as HAL-JSON. It is easy to add support for other formats.
Adding basic support
As explained in How the Serializer works, the serialization process has two parts, normalization and encoding.
If the array structure created by core's default Normalizers is acceptable for your format, then you can simply add an Encoder. For example, this is how support for YAML is added to core.
- Create an encoder
Your Encoder should implement EncoderInterface.
- Register the encoder with the container
Any service added to the container which is tagged with 'encoder' will be added to the encoder array which is passed into the Serializer. This code is placed in your module's Bundle class in the