NAME

Amon2::Plugin::Web::JSON - JSON plugin

SYNOPSIS

use Amon2::Lite;

__PACKAGE__->load_plugins(qw/Web::JSON/);

get '/' => sub {
    my $c = shift;
    return $c->render_json(+{foo => 'bar'});
};

__PACKAGE__->to_app();

DESCRIPTION

This is a JSON plugin.

METHODS

$c->render_json(\%dat);

Generate JSON data from \%dat and returns instance of Plack::Response.

FAQ

How can I use JSONP?

You can use JSONP by using Plack::Middleware::JSONP.

JSON and security

See the hasegawayosuke's article(Japanese).

THANKS TO

hasegawayosuke