> $treex_root );
=head1 DESCRIPTION
Wrapper around regular L<Treex::Core::Node> to provide L<TO_JSON>
method used for converting Treex structure to simple Perl hashes and
arrays.
=head1 IMPORTED CO
andled data type: $decl";
}
return $data;
}
=head2 TO_JSON
Called by L<JSON> package while converting blessed items
=cut
sub TO_JSON {
my $self = shift;
my $n = $self->node;
my $dat
s_in) = @_;
my (@cmd, $single, @paths, $cmd_str, @su, $json, $tests);
# TESTING
# println subname(); ##i
# load JSON module
require JSON::Tiny;
# paths must be sent
if (! defined $paths_i
'-c',
$cmd_str,
);
# run command, get results
$json = capturex(@su);
# decode json
eval {
$tests = JSON::Tiny::decode_json($json);
};
# throw error if unable to decode
if (! $test
ternal {
my (@paths) = @_;
my ($rv);
# TESTING
# println subname(); ##i
# load JSON module
require JSON::Tiny;
# initialize return hashref
$rv = {};
# loop through paths
PATH_LOOP:
interface to SendGrid.com mail gateway APIs
use 5.008;
use Moo 1.006;
use HTTP::Tiny 0.013;
use JSON 2.53;
use URI::Escape 3.30;
use Carp 1.20;
use Mail::SendGrid::Bounce;
has 'api_user' => (is =
nces.get', \%opts, { date => 1 });
if ($response->{success}) {
$bounce_list = decode_json($response->{content});
foreach my $bounce_details (@{ $bounce_list }) {
$boun
es.delete.json';
my $response;
my $json;
my $url;
$response = $self->_make_request('bounces.delete', \%opts, {});
if ($response->{success}) {
$json = decode_json($respons
# {"errors":[{"code":"first_error"},{"code":"second_error","more":"detail"}]}
$c->render(json => { errors => $c->errors });
});
}
1;
=head1 DESCRIPTION
L<Mojolicious::Plugin::Error
g');
# {"errors":[{"code":"first_error"}], "warnings":[{"code":"first_warning"}]}
$c->render(json => {errors => $c->errors, warnings => $c->warnings});
The first argument to L</add_error> or L</
}
$c->render(json => {errors => $c->errors, warnings => $c->warnings});
Additional members can be added to provide more specific information about the
problem. See also L<http://jsonapi.org/format/
k> so to change that try:
rpc_serialized_client_inet:
data_serializer:
serializer: 'JSON::Syck'
=head1 SEE ALSO
=over 4
=item L<RPC::Serialized>
=back
=head1 AUTHOR
Oliver Gorwits
ception::Response;
use MooX::Types::MooseLike::Base qw/Bool/;
use MooseX::Params::Validate;
use JSON::Any;
use LWP::UserAgent;
has base_url => (
is => 'rw',
required => 1,
w
cols_allowed => [ 'http', 'https'],
default_header => [ Accept => 'application/json' ],
);
},
);
has auth_token => (
is => 'rw',
lazy => 1,
default
query_params => { isa => 'HashRef', optional => 1, },
);
my $json = JSON::Any->objToJson(
{
query => $params{query_string},
params => $para
"type must be 'xml' or 'json'" unless grep { $_[0] eq $_ } qw(xml json);
},
lazy => 1,
builder => sub {
($_[0]->file and $_[0]->file =~ /\.json$/) ? 'json' : 'xml';
}
);
sub
.11 of MODS::Record utf8 is enabled by issuing JSON->new->utf8(1)
if($MODS::Record::VERSION >= 0.11){
if($self->type eq "json"){
$self->fh->binmode(":ra
eq "json"){
$self->fh->binmode(':utf8');
}
}
my $m = $self->type eq "xml" ? MODS::Record->from_xml($self->fh) : MODS::Record->from_json($se
package WebService::Reactio;
use 5.008001;
use strict;
use warnings;
use Carp;
use Furl;
use JSON;
our $VERSION = "0.03";
use parent qw/
WebService::Reactio::Incident
/;
sub new {
my ($cla
pe' => 'application/json',
'Accept' => 'application/json',
],
content => $content ? encode_json($content) : undef,
);
return decode_json($response->content
rface to SendGrid Newsletter API
our $VERSION = '0.02'; # VERSION
use HTTP::Request::Common;
use JSON;
use HTTP::Tiny;
use WebService::SendGrid::Newsletter::Lists;
use WebService::SendGrid::Newslett
nt(__PACKAGE__ . '/' .
($__PACKAGE__::VERSION || 0) . ' (Perl)');
$self->{json_options} = $args{json_options};
$self->{last_response} = undef;
$self->{last_response_code} = undef
tter/' . $path . '.json';
my $response = $self->{ua}->post_form($url, $params);
$self->{last_response_code} = $response->{status};
$self->{last_response} = decode_json $response->{conten
TRACT: Load configs from files and the environment
use Moo;
use warnings NONFATAL => 'all';
use JSON::MaybeXS;
use IO::All;
use Try::Tiny;
use Module::Runtime 'use_module';
has _debug => (
is =>
zy => 1,
builder => sub { \&decode_json },
);
has _encode_via => (
is => 'ro',
init_arg => 'encode_via',
lazy => 1,
builder => sub { \&encode_json },
);
sub _io { io->file(shift->_loc
>new(
config_class => 'MyApp::Config',
env_key => 'MYAPP',
location => '.config.json',
);
my $config = $station->load;
=head1 DESCRIPTION
This config loader offers a couple of m
use strict;
use warnings;
package WebService::SendGrid::Newsletter::Lists::Email;
use JSON;
use parent 'WebService::SendGrid::Newsletter::Base';
sub new {
my ($class, %args) = @_;
my $
nto JSON
$args{data} = to_json($args{data}, $self->{sgn}{json_options});
}
elsif (ref $args{data} eq 'ARRAY') {
# Data is an arrayref of hashrefs -- turn each item into JSON
$args{data} = [
map { to_json($_, $self->{sgn}{json_options}); } @{$args{data}}
];
}
return $self->{sgn}->_send_request('lists/email/add', %args);
}
1;
__END__
package WWW::Google::Cloud::Messaging::Response;
use strict;
use warnings;
use JSON qw(decode_json);
use WWW::Google::Cloud::Messaging::Response::ResultSet;
sub new {
my ($class, $http_response
t;
my $reg_ids = [];
if ($is_success) {
$content = decode_json $content;
$reg_ids = decode_json($http_response->request->content)->{registration_ids};
}
else {
encoding utf-8
=head1 NAME
JSON::TypeInference::Type - Classes of JSON types
=head1 DESCRIPTION
The implementations of JSON::TypeInference::Type represent types of JSON values.
They must implemen
8_001;
use Carp qw(croak);
use LWP::UserAgent;
use LWP::ConnCache;
use HTTP::Request;
use JSON qw(encode_json);
use Class::Accessor::Lite (
new => 0,
rw => [qw/ua api_url api_key/],
);
use
{delay_while_idle}) {
$payload->{delay_while_idle} = $payload->{delay_while_idle} ? JSON::true : JSON::false;
}
my $req = HTTP::Request->new(POST => $self->api_url);
$req->header(
;
$req->header('Content-Type' => 'application/json; charset=UTF-8');
$req->content(encode_json $payload);
return $req;
}
1;
__END__
=encoding utf-8
=for stopwords
=head1 NAME
WWW::Goo
information. supports IPv6 address.
=head2 dumper
You can customize the result.
use JSON qw/encode_json/;
builder {
enable 'ModuleInfo',
allow => '127.0.0.1',
my ($info, $env) = @_;
[200, ['Content-Type' => 'application/json'], [encode_json($info)]];
};
sub { [200,[],['OK']] };
};
=head1 REPOSITORY
=be
DF::Trine::Serializer::RDFXML;
use RDF::Trine::Serializer::Turtle;
use RDF::Trine::Serializer::RDFJSON;
use RDF::Trine::Parser;
use RDF::Lazy::Node;
use Scalar::Util qw(blessed refaddr);
use Carp qw(
> $self->{namespaces} ),
@_
);
}
*ttl = *turtle;
sub rdfjson {
shift->_serialize( RDF::Trine::Serializer::RDFJSON->new, @_ );
}
sub rdfxml {
my $self = shift;
$self->_serial
mp in RDF/Turtle, wrapped in a HTML <pre> tag
$g->rdfxml; # dump in RDF/XML
$g->rdfjson; # dump in RDF/JSON
=head1 DESCRIPTION
This module wraps L<RDF::Trine::Node> to provide simple node-centr
package Net::Linkedin::OAuth2;
use strict;
use warnings;
use JSON::Any;
use LWP::UserAgent;
use Carp 'confess';
use XML::Hash;
use Digest::MD5 'md5_hex';
require Exporter;
our @ISA = qw(Exporter);
=> 'https://api.linkedin.com/v1/people/~:(id,formatted-name,picture-url,email-address)?format=json',
token => $token_object->{access_token}
);
# we have the email address
if ($result->{ema
=> 'https://api.linkedin.com/v1/people/~:(id,formatted-name,picture-url,email-address)?format=json',
token => $token_object->{access_token} );
if ($result->{emailAddress}) {
# we have t
pare_files stopvms/;
use File::Slurp qw/read_file/;
use File::Temp qw/tempdir/;
use JSON qw/decode_json encode_json/;
use Sys::Hostname qw/hostname/;
use Time::HiRes qw/time/;
use Try::Tiny;
use Log:
ist;
$meta->{timeout} = $timeout_override if defined $timeout_override;
$meta->{tests} = decode_json $pb->{tests} if $meta->{runner} eq 'File';
$job->{contest} &&= contest_entry($job->{contest});
meta->{result},
result_text => $meta->{result_text},
($meta->{results} ? (results => encode_json $meta->{results}) : ()),
$meta->{errors} ? (errors => $meta->{errors}) : ());
}
sub got_job{
JSON;
use MIME::Base64 qw( encode_base64 decode_base64 );
use Exporter 'import';
our @EXPORT_OK = qw(
encode_json_for_signing
encode_base64_unpadded
decode_base64
sign_json signed_json
verify_json_signature
redact_event redacted_event
sign_event_json signed_event_json
verify_event_json_signature
);
my $sign = Crypt::NaCl::Sodium->sign;
my $json_canon = JSON->new
=cut
=head1 FUNCTIONS
=cut
=head2 encode_json_for_signing
$json = encode_json_for_signing( $data )
Encodes a given HASH reference as Canonical JSON, having removed the
C<signatures> and C<uns
TheGameCrafter::Client::VERSION = '0.0103';
}
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON;
use URI;
use Ouch;
use parent 'Exporter';
our @EXPORT = qw(tgc_get tgc_delete tgc_put tgc_post)
request( @_ ));
}
sub _process_response {
my $response = shift;
my $result = eval { from_json($response->decoded_content) };
if ($@) {
ouch 500, 'Server returned unparsable conte
ult->{error}{data};
}
}
=head1 PREREQS
L<LWP::UserAgent>
L<Ouch>
L<HTTP::Request::Common>
L<JSON>
L<URI>
=head1 SUPPORT
=over
=item Repository
L<http://github.com/rizen/TheGameCrafter-Client