Thanks Michael,
I do use the JSON plug-in , but I've always done it this way:
sub get_json { #
my $perl_data_structure = shift;
use JSON; # func interface imports objToJson
return objToJson( $perl_data_structure );
}
Michael Peters wrote:
Bruce McKenzie wrote:
This question would actually sort of fit into the Ajax thread which is
under the subject "Test 2 - is this thing on" :-)
Anyway, should I be changing the header type when returning JSON or
something other than HTML from CAP?
If you used CAP::JSON (another plug) you wouldn't have to worry about this:
return $self->json_body({ foo => 'stuff', bar => [0,1,2,3]} );
But yes you do need to change it. I usually use "text/x-json", but there are a
couple of derivatives that will work as well.
--
Bruce
http://www.2MinuteExplainer.com
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]