ion => $VERSION,
base => 'XAS::Singleton',
accessors => 'spooler',
codec => 'JSON',
utils => ':validation',
filesystem => 'Dir'
;
# -------------------------------------
y => $self->env->facility,
message => $message,
};
my $json = encode($data);
$self->spooler->write($json);
}
# ----------------------------------------------------------------
;
# base class for representing Deezer objects
subtype 'JSONBoolean' => (as 'Int');
coerce 'JSONBoolean' => (
from 'Ref',
via { JSON::is_bool($_) }
);
subtype 'Url' => as 'Str',
where
atmandu::Sane;
use LWP::UserAgent;
use JSON;
has query => (is => 'ro', required => 1);
has url => (is => 'ro', default => 'http://vocab.getty.edu/sparql.json');
has lang => (is => 'ro', default =
onse = $self->ua->post($self->url, $form);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code
b action {
my $self = shift();
my $mongo = $self->mongodb();
...
return $self->render( json => undef );
}
Just in case you need access to the MongoDB client instance you can use this help
g/licenses/MIT MIT License
# @link https://gluu.org/
# @since Version 2.4.4
# @filesource
#/
use JSON::PP;
package OxdRegister; # This is the "Class"
use vars qw($VERSION);
$VERSIO
pi_url = "http://fantasysports.yahooapis.com/fantasy/v2/team/265.l.5098.t.2/players?format=json";
my $json = $oauth->access_api( $token, $api_url );
OTHER METHODS:
The token expires after
m Yahoo API is returned verbatim.
This means if you request JSON in the URL, then you'll get JSON back; otherwise XML.
my $json = $oauth->access_api( $token, $url );
=cut
sub access_api {
atmandu::Sane;
use LWP::UserAgent;
use JSON;
has query => (is => 'ro', required => 1);
has url => (is => 'ro', default => 'http://vocab.getty.edu/sparql.json');
has lang => (is => 'ro', default =
onse = $self->ua->post($self->url, $form);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code
eanJSON;
our $DATE = '2017-01-03'; # DATE
our $VERSION = '0.002'; # VERSION
use 5.010001;
use strict;
use warnings;
use Exporter qw(import);
our @EXPORT_OK = qw(
clean_json_i
n_place
clone_and_clean_json
);
sub _clone {
if (eval { require Data::Clone; 1 }) {
Data::Clone::clone(@_);
} else {
require Clone::PP;
e::PP::clone(@_);
}
}
# generated with Data::Clean version 0.44, Data::Clean::JSON version 0.37
sub clean_json_in_place {
require Scalar::Util;
state $sub_unbless = sub { my $ref = shift
e strict;
use warnings;
use Jmespath::LexerException;
use Jmespath::EmptyExpressionException;
use JSON;
use String::Util qw(trim);
use List::Util qw(any);
use Try::Tiny;
use utf8;
use feature 'unicode
;
$lexeme =~ s/\\`/`/;
my $parsed_json;
try {
$parsed_json = JSON->new->allow_nonref->decode($lexeme);
} catch {
try {
$parsed_json = JSON->new->allow_nonref->decode('"' . trim(
ken_len = $self->{_position} - $start;
return { type => 'literal',
value => $parsed_json,
start => $start,
end => $token_len, };
}
sub _consume_quoted_identifier
ot receive a token or URL", "access_api() test without params" );
my $json = $oauth->access_api( $token, $api_url );
like( $json, qr/yahoo/, "access_api() test with token & URL" );
$oauth->save_toke
Jmespath;
use strict;
use warnings;
use Jmespath::Parser;
use Jmespath::Visitor;
use JSON qw(encode_json decode_json);
use Try::Tiny;
use v5.14;
our $VERSION = '0.02';
use utf8;
use Encode;
sub compi
$result if not defined $result;
# JSON block result
if ( ( ref ($result) eq 'HASH' ) or
( ref ($result) eq 'ARRAY' ) ) {
try {
$result = JSON->new
->utf8(1)
->al
UOTED} == 0 or
not defined $ENV{JP_UNQUOTED} ) {
$result = q{"} . $result . q{"};
}
return $result;
}
1;
__END__
=head1 NAME
Jmespath - Enabling easy querying for JSON structures.
' => sub { ${$_[0]}},
"." => sub { ${$_[0]}},
"eq" => sub { ${$_[0]} },
fallback => sub { ${$_[0]} },
);
sub TO_JSON { return '' . shift; }
1;
et
# @see OxdClient
# @see OxdConfig
#######################################
use JSON::PP;
package UpdateRegistration;
use vars qw($VERSION);
$VERSION = '0.01';
warnings;
use Try::Tiny;
use List::Util qw(unpairs);
use Scalar::Util qw(looks_like_number);
use JSON;
use Jmespath::Expression;
use Jmespath::Functions qw(:all);
use Jmespath::AttributeException;
us
eturn $result;
}
=item visit_field(node, value)
Returns the value of a field in the JSON data.
value : the JSON data
node : the AST node being evaluated.
=cut
sub visit_field {
my ($self, $node
not defined $value;
# SHEER NEGATIVE ENERGY HACKERY - FORCE NUMBERS TO BE NUMBERS
# THANK YOU JSON.PM
$value = 1 * $value if $value =~ /^[-][0-9]+$/;
return $value;
}
sub visit_index {
my (
package Jmespath::Functions;
use strict;
use warnings;
use parent 'Exporter';
use JSON;
use Try::Tiny;
use POSIX qw(ceil floor);
use Jmespath::Expression;
use Jmespath::ValueException;
use Jmespath::J
ueException
->new({ message => 'contains() illegal boolean value' })
->throw
if JSON::is_bool($arg);
Jmespath::ValueException
->new({ message => 'Not a number: [' . $arg .
if JSON::is_bool($subject);
if ( ref $subject eq 'ARRAY' ) {
foreach (@$subject) {
return JSON::true if ( $_ eq $search ); #must be exact string match
}
return JSON::false;
\@ARGV,
});
# Use of JSON serializer
my $logger = Log::UDP::Client->new( serializer_module => 'JSON' );
# Will emit { "message" => "Hi" } because JSON want to wrap stuff into a hash
about them there.
=head1 SEE ALSO
=over 4
=item *
L<Moose>
=item *
L<Storable>
=item *
L<JSON::XS>
=item *
L<IO::Socket::INET>
=back
=for :stopwords cpan testmatrix url annocpan anno bugt
plugins => [
#pod 'GatherDir',
#pod 'Manifest',
#pod 'MetaJSON',
#pod ],
#pod files => {
#pod 'lib/Dummy.pm' => 'package Dummy; 1;',
re( qr{^# This file was } ),
#pod 'MANIFEST',
#pod 'META.json',
#pod 'dist.ini',
#pod 'lib/Dummy.pm',
#pod
test' => {
plugins => [
'GatherDir',
'Manifest',
'MetaJSON',
],
files => {
'lib/Dummy.pm' => 'package Dummy; 1;',
},
od sub _build_plugin { [
#pod 'GatherDir',
#pod 'Manifest',
#pod 'MetaJSON',
#pod ] };
#pod
#pod run_me {
#pod plugins => [
#pod 'GatherDir',
#p
.json' => sub {
#pod my ( $self ) = @_;
#pod $self->skip_if_exception();
#pod my $built_in = path( $self->tzil->built_in );
#pod my $json = $built_in->child( 'META.json
' )->slurp_utf8;
#pod cmp_deeply( $json, $self->expected->{ json } );
#pod };
#pod
#pod =cut
has tzil => (
is => 'ro',
isa => 'Object',
lazy => 1,
ce;
use lib './modules';
use Attribute::Handlers;
#use strict;
use warnings;
use 5.010;
use JSON::PP;
use Data::Dumper qw(Dumper);
use utf8;
use Encode;
use File::Basename;
use warnings;
=> shift,
# @var string $base_url Base url for log file directory and oxd-rp-setting.json file.
_base_url => dirname(__FILE__)
};
bless $self, $class;
return $self;
}
has 'format' => (
is => 'rw',
default => sub { 'json' },
);
=head1 METHODS
=head2 new({ api_key => $key [, format => '(xml|json)'] })
Create a new L<Guardian::OpenPlatform::API> objec
default format for the data that you get
back from the Guardian. Valid values are 'json' or 'xml'. Default is 'json'.
=back
=head2 content({ qry => $query, [ filter => $filter, format => $fmt ] });
mat
This item is optional. Defines the data format that you want to get back.This can
be either 'json' or 'xml'. If no value is given then the default format given to
the C<new> method is used.
=ba