Serialization
Edit on GitHubAPI Platform uses the Spryker Serializer module for converting between PHP objects back and forth. The Serializer is registered as a Symfony service and integrates directly with API Platform’s serialization pipeline.
How it works
When a request hits an API Platform endpoint:
- Request deserialization — the incoming payload is deserialized into the resource object using the Serializer. (API Platform)
- Provider/Processor — your provider or processor works with the resource object, converts to array and or Transfer objects, and vice versa.
- Response serialization — the resource object is serialized back into the expected response format. (API Platform)
API Platform handles this automatically. You interact with the Serializer only when you need to customize serialization behavior.
Customizing serialization context
Use SerializerContextTransfer to control how data is serialized in your providers or processors. Common use cases:
- Serialization groups — control which properties are included in the response
- Skip null values — omit null properties from the output
- DateTime formatting — set a custom date/time format
For the full list of available context options, see the Serializer guidelines.
Custom normalizers
To add a custom normalizer that applies to API Platform resources, implement SerializerNormalizerPluginInterface and register it in SerializerDependencyProvider. Custom normalizers take priority over built-in normalizers.
For details on the Symfony Serializer component, see the Symfony documentation.
Thank you!
For submitting the form