package Sledge::Plugin::JSON;
use warnings;
use strict;
use JSON::Syck;
our $VERSION = '0.01';
our $ConformToRFC4627 = 0;
sub import {
my $self = shift;
my $pkg = caller;
no strict 'r
efs';
*{"$pkg\::output_json"} = \&_output_json;
}
sub _output_json {
my ($self, $args) = @_;
my $encoding = $args->{encoding} ? $args->{encoding} : 'utf-8';
my $content_type =
self, $encoding );
my $json = JSON::Syck::Dump($args->{data});
my $output = _add_callback($self, _validate_callback_param($self, $self->r->param('callback')), $json );
$self->r->content_