We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 344d8ba + 2a8ffcb commit 44d5b34Copy full SHA for 44d5b34
serializer.rst
@@ -1877,6 +1877,14 @@ to ``true``::
1877
]);
1878
// $jsonContent contains {"name":"Jane Doe"}
1879
1880
+Preserving Empty Objects
1881
+~~~~~~~~~~~~~~~~~~~~~~~~
1882
+
1883
+By default, the Serializer transforms an empty array to ``[]``. You can change
1884
+this behavior by setting the ``AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS``
1885
+context option to ``true``. When the value is an instance of ``\ArrayObject()``,
1886
+the serialized data will be ``{}``.
1887
1888
Handling Uninitialized Properties
1889
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1890
0 commit comments