From cc545179bf39d938a40935d94dcc9554b1bb3d18 Mon Sep 17 00:00:00 2001 From: Alan Poulain Date: Wed, 13 Jul 2022 17:51:15 +0200 Subject: [PATCH] fix(serializer): missing empty_array_as_object in example --- serializer.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/serializer.rst b/serializer.rst index 0b705aa5a41..f404608133c 100644 --- a/serializer.rst +++ b/serializer.rst @@ -102,12 +102,15 @@ resources. This context is passed to all normalizers. For example: * :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` uses ``datetime_format`` key as date time format; * :class:`Symfony\\Component\\Serializer\\Normalizer\\AbstractObjectNormalizer` - uses ``empty_iterable_as_object`` to represent empty objects as ``{}`` instead + uses ``preserve_empty_objects`` to represent empty objects as ``{}`` instead + of ``[]`` in JSON. +* :class:`Symfony\\Component\\Serializer\\Serializer` + uses ``empty_array_as_object`` to represent empty arrays as ``{}`` instead of ``[]`` in JSON. .. versionadded:: 5.4 - The usage of the ``empty_array_as_object`` option by default in the + The usage of the ``empty_array_as_object`` option in the Serializer was introduced in Symfony 5.4. You can pass the context as follows::