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/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.