Skip to content

Commit 8ac80d3

Browse files
authored
[Serializer] (re)document PRESERVE_EMPTY_OBJECTS
1 parent 97400af commit 8ac80d3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

serializer.rst

+7
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,13 @@ to ``true``::
18691869
]);
18701870
// $jsonContent contains {"name":"Jane Doe"}
18711871

1872+
Preserving Array Values
1873+
~~~~~~~~~~~~~~~~~~~~~~~~
1874+
1875+
By default, the Serializer will transform an empty array to `[]`.
1876+
You can change this behavior by setting the ``AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS`` context option
1877+
to ``true``, the value would be `{}`.
1878+
18721879
Handling Uninitialized Properties
18731880
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18741881

0 commit comments

Comments
 (0)