X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FChatty%2FView%2FJSON.pm;fp=lib%2FChatty%2FView%2FJSON.pm;h=30510ca28637d3c8a67073d6a4e50572179fc86f;hb=30558f981fe131d1ae3cc88ff5fc7f9e910932e9;hp=0000000000000000000000000000000000000000;hpb=99657a2f36e38272de6820fce26839109bf05747;p=chaz%2Fchatty diff --git a/lib/Chatty/View/JSON.pm b/lib/Chatty/View/JSON.pm new file mode 100644 index 0000000..30510ca --- /dev/null +++ b/lib/Chatty/View/JSON.pm @@ -0,0 +1,37 @@ +package Chatty::View::JSON; + +use JSON::XS (); + +use Moose; +use MooseX::NonMoose; +use namespace::autoclean; + +extends 'Catalyst::View::JSON'; + +sub encode_json { + my ($self, $c, $data) = @_; + JSON::XS->new->ascii->pretty->allow_nonref->encode($data); +} + +=head1 NAME + +Chatty::View::JSON - Catalyst View + +=head1 DESCRIPTION + +Catalyst View. + +=head1 AUTHOR + +Charles McGarvey + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +__PACKAGE__->meta->make_immutable; + +1;