You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: serializer.rst
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -148,18 +148,22 @@ properties and setters (``setXxx()``) to change properties:
148
148
;
149
149
};
150
150
151
-
Serializer context
151
+
Serializer Context
152
152
------------------
153
153
154
-
The serializer can use a (de)serialization context to control how a resource is (de)serialized.
155
-
The context is passed to all normalizers. For example:
154
+
The serializer can define a context to control how the (de)serialization of
155
+
resources. This context is passed to all normalizers. For example:
156
156
157
-
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` uses ``datetime_format`` key as date time format;
158
-
* :class:`Symfony\\Component\\Serializer\\Normalizer\\AbstractObjectNormalizer` uses ``empty_iterable_as_object`` to preserve empty objects (keeps ``{}`` instead of ``[]`` in JSON);
uses ``empty_iterable_as_object`` to represent empty objects as ``{}`` instead
161
+
of ``[]`` in JSON.
159
162
160
163
.. versionadded:: 5.4
161
164
162
-
:class:`Symfony\\Component\\Serializer\\Serializer` uses ``empty_arrays_as_object`` to serialize empty array as object (uses ``{}`` instead of ``[]`` in JSON);
165
+
The usage of the ``empty_arrays_as_object`` option by default in the
0 commit comments