Skip to content

Commit 91b2d00

Browse files
dfridrichwouterj
authored andcommitted
Added docs for JSON helper
1 parent 51eb51a commit 91b2d00

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

book/controller.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,20 @@ There are also special classes to make certain kinds of responses easier:
774774
:class:`Symfony\\Component\\HttpFoundation\\StreamedResponse`.
775775
See :ref:`streaming-response`.
776776

777+
JSON helper
778+
~~~~~~~~~~~
779+
780+
You can simplify sending JSON response with
781+
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::json`
782+
helper::
783+
784+
public function jsonAction()
785+
{
786+
$data = [1, 2, 3];
787+
788+
return $this->json($data);
789+
}
790+
777791
.. seealso::
778792

779793
Now that you know the basics you can continue your research on Symfony

0 commit comments

Comments
 (0)