We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 866af09 commit 1a8d0dcCopy full SHA for 1a8d0dc
components/serializer.rst
@@ -90,7 +90,11 @@ use the Serializer service created before::
90
$person->setName('foo');
91
$person->setAge(99);
92
93
- $serializer->serialize($person, 'json'); // Output: {"name":"foo","age":99}
+ $jsonContent = $serializer->serialize($person, 'json');
94
+
95
+ // $jsonContent contains {"name":"foo","age":99}
96
97
+ echo $jsonContent; // or return it in a Response
98
99
The first parameter of the :method:`Symfony\\Component\\Serializer\\Serializer::serialize`
100
is the object to be serialized and the second is used to choose the proper encoder,
0 commit comments