[Catalyst] RE: DBIC <-> JSON conversion for AJAX
Eden Cardim
edencardim at gmail.com
Mon Sep 12 20:31:03 GMT 2011
>>>>> "Roland" == Roland Philibert <rphilibert at aptina.com> writes:
Roland> Thanks all for your suggestions so far. I was I guess on
Roland> the right track with JSON:XS but I had also seen REST but so
Roland> far I am still unsure as what the best way to go
Catalyst::Controller::REST + DBIx::Class::ResultClass::HashRefInflator
works pretty well:
$self->status_ok(
$c,
entity => $rs->search({}, {
result_class => 'DBIx::Class::ResultClass::HashRefInflator'
})->next
);
Then if you ask for a Content-Type of application/json you'll get JSON
from that in your response.
--
Eden Cardim
Code Monkey http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://blog.edencardim.com/ http://www.shadowcat.co.uk/servers/
http://twitter.com/#!/edenc
More information about the Catalyst
mailing list