Hi,

per popular demand, I added and documented the way how you can bypass
JSON::Any and do what you want with your favorite JSON encoder. Quote
from POD,

OVERRIDING JSON ENCODER
       By default it uses JSON::Any to serialize perl data strucuture into
       JSON data format. If you want to avoid this and encode with your own
       encoder (like passing options to JSON::XS etc.), you can implement
       "encode_json" method in your View class.

         package MyApp::View::JSON;
         use base qw( Catalyst::View::JSON );

         use JSON::XS;

         sub encode_json {
             my($self, $c, $data) = @_;
             my $encoder = JSON::XS->new->ascii->pretty->allow_nonref;
             $encoder->encode($data);
         }

         1;

Will be available on CPAN shortly and also from
http://svn.bulknews.net/repos/public/Catalyst-View-JSON/trunk


-- 
Tatsuhiko Miyagawa

_______________________________________________
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