Symfony Serializer Component
repository·8.2·Indexed 25 days ago
https://github.com/symfony/serializerA component for converting data structures and complex object graphs into formats such as JSON, XML, or arrays, and reconstructing those structures via deserialization. Includes the `debug:serializer` command to inspect serialization metadata like groups, names, and discriminator mappings for specific classes.
What's inside symfony/serializer
- The Serializer component provides functionality to convert data structures (including complex object graphs) into different formats such as JSON, XML, or arrays, and vice versa (deserialization).
Use the debug:serializer command arguments and output
8.2The
debug:serializercommand accepts one argument:class(Required): The fully qualified class name (FQCN) you want to inspect.
Output Format: If the class is found and has metadata, the command displays a table with two columns:
- Property: The name of the property being inspected.
- Options: A dumped representation of the metadata associated with that property, including:
groups: The serialization groups assigned to the property.maxDepth: The maximum depth allowed for this property.serializedName: The name used during serialization.serializedPath: The path used during serialization.ignore: Whether the property is ignored.normalizationContexts: Contexts used during normalization.denormalizationContexts: Contexts used during denormalization.discriminatorMap: (If applicable) The mapping of types for class discriminators.
Debug serialization information with debug:serializer
8.2The
debug:serializercommand allows you to inspect the serialization metadata (groups, names, depth, etc.) configured for a specific class. This is useful for verifying that attributes like#[Groups],#[SerializedName], or discriminator mappings are correctly recognized by the Serializer component.To use the command, provide the fully qualified class name (FQCN) as a required argument.