@@ -734,7 +734,24 @@ When serializing, you can set a callback to format a specific object property::
734734Normalizers
735735-----------
736736
737- There are several types of normalizers available:
737+ Normalizers turn **object ** into **array ** and vice versa. They implement
738+ ::class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ NormalizableInterface `
739+ for normalize (object to array) and
740+ :class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ DenormalizableInterface ` for denormalize
741+ (array to object).
742+
743+ You can add new normalizers to a Serializer instance by using its first constructor argument::
744+
745+ use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
746+ use Symfony\Component\Serializer\Serializer;
747+
748+ $normalizers = [new ObjectNormalizer()];
749+ $serializer = new Serializer($normalizers, []);
750+
751+ Built-in Normalizers
752+ ~~~~~~~~~~~~~~~~~~~~
753+
754+ The Serializer component provides several built-in normalizers:
738755
739756:class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ ObjectNormalizer `
740757 This normalizer leverages the:doc: `PropertyAccess Component </components/property_access >`
@@ -820,6 +837,14 @@ There are several types of normalizers available:
820837
821838 The ``UidNormalizer `` was introduced in Symfony 5.2.
822839
840+ ..note ::
841+
842+ You can also create your own Normalizer to use another structure. Read more at
843+ :doc: `/serializer/custom_normalizer `.
844+
845+ All these normalizers are enabled by default when using the Serializer component
846+ in a Symfony application.
847+
823848.. _component-serializer-encoders :
824849
825850Encoders
@@ -858,6 +883,11 @@ The Serializer component provides several built-in encoders:
858883:class: `Symfony\\ Component\\ Serializer\\ Encoder\\ CsvEncoder `
859884 This encoder encodes and decodes data in `CSV `_.
860885
886+ ..note ::
887+
888+ You can also create your own Encoder to use another structure. Read more at
889+ :doc: `/serializer/custom_encoders `.
890+
861891All these encoders are enabled by default when using the Serializer component
862892in a Symfony application.
863893
@@ -977,25 +1007,51 @@ which defines the configuration options for the XmlEncoder an associative array:
9771007
9781008These are the options available:
9791009
980- ====================== ==================================================== ==========================
981- Option Description Default
982- ====================== ==================================================== ==========================
983- ``xml_format_output `` If set to true, formats the generated XML with line
984- breaks and indentation.
985- ``xml_version `` Sets the XML version attribute ``1.1 ``
986- ``xml_encoding `` Sets the XML encoding attribute ``utf-8 ``
987- ``xml_standalone `` Adds standalone attribute in the generated XML ``true ``
988- ``xml_root_node_name `` Sets the root node name (default: ``response ``).
989- ``remove_empty_tags `` If set to true, removes all empty tags in the ``false ``
990- generated XML
991- ====================== ==================================================== ==========================
1010+ ============================== ================================================= ==========================
1011+ Option Description Default
1012+ ============================== ================================================= ==========================
1013+ ``xml_format_output `` If set to true, formats the generated XML with
1014+ line breaks and indentation.
1015+ ``xml_version `` Sets the XML version attribute ``1.1 ``
1016+ ``xml_encoding `` Sets the XML encoding attribute ``utf-8 ``
1017+ ``xml_standalone `` Adds standalone attribute in the generated XML ``true ``
1018+ ``xml_type_cast_attributes `` This provides the ability to forgot the attribute ``true ``
1019+ type casting
1020+ ``xml_root_node_name `` Sets the root node name (default: ``response ``).
1021+ ``as_collection `` Always returns results as a collection, even if
1022+ only one line is decoded
1023+ ``decoder_ignored_node_types `` Sets nodes to be ignored in the decode ``[\XML_PI_NODE, \XML_COMMENT_NODE] ``
1024+ ``encoder_ignored_node_types `` Sets nodes to be ignored in the encode ``[] ``
1025+ ``load_options `` XML loading `options with libxml `_ ``\LIBXML_NONET | \LIBXML_NOBLANKS ``
1026+ ``remove_empty_tags `` If set to true, removes all empty tags in the ``false ``
1027+ generated XML
1028+ ============================== ================================================= ==========================
9921029
9931030The ``YamlEncoder ``
9941031~~~~~~~~~~~~~~~~~~~
9951032
9961033This encoder requires the:doc: `Yaml Component </components/yaml >` and
9971034transforms from and to Yaml.
9981035
1036+ The ``YamlEncoder `` Context Options
1037+ ...................................
1038+
1039+ The ``encode() `` method, like other encoder, uses ``context `` to set
1040+ configuration options for the YamlEncoder an associative array::
1041+
1042+ $xmlEncoder->encode($array, 'xml', $context);
1043+
1044+ These are the options available:
1045+
1046+ =============== ======================================================== ==========================
1047+ Option Description Default
1048+ =============== ======================================================== ==========================
1049+ ``yaml_inline `` The level where you switch to inline YAML ``0 ``
1050+ ``yaml_indent `` The level of indentation (used internally) ``0 ``
1051+ ``yaml_flags `` A bit field of ``Yaml::DUMP_* `` / ``PARSE_* `` constants ``0 ``
1052+ to customize the encoding / decoding YAML string
1053+ =============== ======================================================== ==========================
1054+
9991055Skipping ``null `` Values
10001056------------------------
10011057
@@ -1550,6 +1606,7 @@ Learn more
15501606.. _`PSR-1 standard` :https://www.php-fig.org/psr/psr-1/
15511607.. _`JMS serializer` :https://github.com/schmittjoh/serializer
15521608.. _RFC3339 :https://tools.ietf.org/html/rfc3339#section-5.8
1609+ .. _`options with libxml` :https://www.php.net/manual/en/libxml.constants.php
15531610.. _JSON :http://www.json.org/
15541611.. _XML :https://www.w3.org/XML/
15551612.. _YAML :https://yaml.org/