From ba6a922d1446395fdcf8a4351eefc7b74a39e041 Mon Sep 17 00:00:00 2001 From: Dennis Fridrich Date: Sun, 10 Apr 2016 22:07:58 +0200 Subject: [PATCH] Update docs for JSON helper --- book/controller.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/book/controller.rst b/book/controller.rst index d77ead8b572..9760c611d46 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -781,6 +781,10 @@ You can simplify sending JSON response with :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::json` helper:: + $this->json($data, $status = 200, $headers = array(), $context = array()); + +For example if you want to send some simple array you can use it like this:: + public function jsonAction() { $data = [1, 2, 3];