e Eve::Json;
use parent qw(Eve::Class);
use strict;
use warnings;
use JSON::XS;
use Eve::Exception;
=head1 NAME
B<Eve::Json> - a JSON converter adapter.
=head1 SYNOPSIS
use Eve::Json;
son = Eve::Json->new();
my $json_string = $json->encode(reference => $reference);
my $decoded_reference = $json->decode(string => $json_string);
=head1 DESCRIPTION
The B<Eve::Json> class ad
nality of the JSON::XS
module to provide JSON encoding and decoding features service.
=head1 METHODS
=head2 B<init()>
=cut
sub init {
my $self = shift;
$self->{'json'} = JSON::XS->new()->
st::Psgi;
use parent qw(Eve::HttpRequest);
use strict;
use warnings;
use Hash::MultiValue;
use JSON::XS;
use Plack::Request;
=head1 NAME
B<Eve::HttpRequest::Psgi> - an HTTP request adapter for th
t_type() eq 'application/json') {
$self->_body_parameters = Hash::MultiValue->new(
%{$self->cgi->query_parameters()->as_hashref_mixed()},
%{JSON::XS->new()->utf8()->dec
ode => $code);
$expected_response->set_body(
text => $self->{'registry'}->get_json()->encode(
reference => $body));
is(
$response->get_text(),
=item C<json>
a JSON encoder object.
=back
=head1 METHODS
=head2 B<init()>
=cut
sub init {
my ($self, %arg_hash) = @_;
my $arg_hash = Eve::Support::arguments(\%arg_hash, my $json);
$self->{'_json'} = $json;
$self->{'_id'} = undef;
$self->SUPER::init(%{$arg_hash});
return;
}
=head2 B<_read()>
This method is called when the graph node or connection is requested
wi
ntent-Type', value => 'text/javascript');
$self->_response->set_body(
text => $self->_json->encode(reference => $reference));
return;
}
=head1 SEE ALSO
=over 4
=item L<Eve::HttpRes
;
use Eve::HttpDispatcher;
use Eve::HttpResource::Template;
use Eve::HttpResponse::Psgi;
use Eve::Json;
use Eve::PgSql;
use Eve::Session;
use Eve::Template;
use Eve::Uri;
=head1 NAME
B<Eve::Registry
});
}
=head2 B<get_json()>
A JSON converter adapter class lazy loader service.
=cut
sub get_json {
my $self = shift;
return $self->lazy_load(
name => 'json',
code => sub
{
return Eve::Json->new();
});
}
=head2 B<add_binding>
A shorthand method for binding resources to specific URI
patterns. Accepts arguments as a simple list, which are resource