On Wed, Apr 15, 2009 at 4:19 AM, W. Tyler Gee <[email protected]> wrote:

> I think the recommended module would be Catalyst::View::JSON and if you
> want to change anything you just plug in a different driver via the config
> rather than worrying about altering the View itself.
> ~Tyler
>
> 2009/4/14 Octavian Râşniţă <[email protected]>
>
>> Hi,
>>
>>
>> What's the recommended module for getting a JSON request and creating a
>> JSON response in a Catalyst app?
>> (I want to use them with JQuery.)
>>
>> Thanks.
>>
>> Octavian
>>
>>
>> _______________________________________________
>> List: [email protected]
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/[email protected]/
>> Dev site: http://dev.catalyst.perl.org/
>>
>
>
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
>
>

The other solutions above that don't have you using View::JSON are wrong.

Use Catalyst::View::JSON.

Do not use other things (unless it is REST, in which case let it delegate to
Catalyst::Action::Serialize::JSON, but in the future I am hoping to patch
this to use Catalyst::View::JSON as well) as that is not the right way to do
it.

Additionally, View::JSON has a lot of use cases and maturity baked into it.
It handles utf8 properly, and many other little things.

Doing it yourself is wrong, and unless you copied the serialization code
from View::JSON, you are missing something.

(The Catalyst::Plugin::Server mechanism is fine if you are using that, too.
For RPC stuff you do need to alter the request cycle slightly, however I
would hope it still uses Catalyst::View::JSON)

-J
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to