We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 97400af + e384239 commit 2a8ffcbCopy full SHA for 2a8ffcb
serializer.rst
@@ -1869,6 +1869,14 @@ to ``true``::
1869
]);
1870
// $jsonContent contains {"name":"Jane Doe"}
1871
1872
+Preserving Empty Objects
1873
+~~~~~~~~~~~~~~~~~~~~~~~~
1874
+
1875
+By default, the Serializer transforms an empty array to ``[]``. You can change
1876
+this behavior by setting the ``AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS``
1877
+context option to ``true``. When the value is an instance of ``\ArrayObject()``,
1878
+the serialized data will be ``{}``.
1879
1880
Handling Uninitialized Properties
1881
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1882
0 commit comments