On 4/24/11 2:57 PM, stickaforkinme wrote:
I'm sure this is a really really stupid question but I can't seem to
find a clean way to return a JSON object, i.e. by not calling a
controller and just returning the result of json_encode. This was easy
is Symfony 1.x but I have no idea how to do it in Symfony2. Any body
know how to do this??

I have a simple action function and just want to return a json object
containing some data, that's all.

In your action:

return new Response(json_encode($data));

Fabien

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to