and convert the result for the "new" method.
It is use by "new_with_options".
=cut
my $decode_json;
sub parse_options {
my ( $class, %params ) = @_;
my %options_data = $class->_options
f ( $data{json} ) {
defined $decode_json
or $decode_json = eval {
use_module("JSON::MaybeXS");
JSON::MaybeXS
->can("decode_json");
};
defined $decode_json
or $decode_json = eval {
use_module("JSON::PP");
package DR::TarantoolQueue;
use utf8;
use strict;
use warnings;
use Mouse;
use Carp;
use JSON::XS;
require DR::TarantoolQueue::Task;
$Carp::Internal{ (__PACKAGE__) }++;
our $VERSION = '0.44';
use fea
n option log_adapter => (is => "ro", required => 1, trigger => 1, json => 1 );
option connection => (is => "ro", required => 1, json => 1);
sub _trigger_log_adapter { my ( $self, $opts ) = @_; lo
IONS_ATTRIBUTES
= qw/format short repeatable negatable autosplit autorange doc long_doc order json hidden spacer_before spacer_after/;
sub import {
my ( undef, @import ) = @_;
my $options
ions{order} = 0 if !defined $options{order};
if ( $options{json}
|| ( defined $options{format} && $options{format} eq 'json' ) )
{
delete $options{repeatable};
delete
ange};
delete $options{negativable};
delete $options{negatable};
$options{json} = 1;
$options{format} = 's';
}
if ( $options{autorange} and not defined $opti
format_doc->{$format} if defined $format;
$format_doc_str = 'JSON'
if defined $options_data{ $opt->{name} }{json};
my $spec
= ( defined $short ? "-" . $short .
format_doc->{$format} if defined $format;
$format_doc_str = 'JSON'
if defined $options_data{ $opt->{name} }{json};
push @message,
( defined $short ? "-" . $sh
{$format}
if defined $format;
$format_doc_str = 'JSON'
if defined $options_data{ $opt->{name} }{json};
my $opt_long_name
= "-" . ( length( $opt->{n
e RDF::Query;
use RDF::LDF;
use RDF::aREF;
use RDF::aREF::Encoder;
use RDF::NS;
use IO::Pipe;
use JSON;
use LWP::UserAgent::CHICaching;
our $VERSION = '0.32';
with 'Catmandu::RDF';
with 'Catmandu::I
de($pipe,':encoding(UTF-8)');
return sub {
state $line = <$pipe>;
return decode_json($line) if defined($line);
waitpid($pid,0);
return undef;
};
}
else {
#
is_literal ? $triple->object->literal_datatype : undef;
# Create the RDF::Trine type RDF/JSON RDF::aREF can parse
my $hashref = {};
$hashref->{$subject}->{$predicate}->[0]->{
e aliases C<ttl> for C<Turtle>, C<n3> for
C<Notation3>, C<xml> and C<XML> for C<RDFXML>, C<json> for C<RDFJSON>.
When the option C<type> is set to 'NTriples' the export can be streamed in all
other
ose;
use Carp;
use LWP;
use LWP::UserAgent;
use LWP::Debug;
use SOAP::Lite;
use Data::Dumper;
use JSON;
use XML::Parser;
use XML::Parser::EasyTree;
$XML::Parser::EasyTree::Noempty = 1;
use Storable qw
'application/json');
#$req->content($content);
my $res = $ua->request($req);
my $json;
if ($res->is_success) {
#deb($res->content."\n");
$json = decode_json($res->conte
deb Dumper($json)."\n";
#deb($json->{'Status'}."\n");
} else {
deb($res->status_line, "\n");
return; # error occurred - exit
}
#deb(@{$json}."\n");
deb "
igest::SHA1 qw/sha1_hex/;
use File::Share qw/dist_file/;
use File::Slurp::Tiny qw/read_file/;
use JSON::MaybeXS;
use List::Util qw/any max min/;
use Redis;
use Try::Tiny;
use namespace::clean;
#pod =
"$_ undefined" for qw/interval limit/;
[
map 0+$_, # numify for later JSON encoding
@{$rule}{qw/interval limit/},
grep defined, $rule->{prec
eval($script, @params);
};
}
has _json_encoder => (
is => 'ro',
default => sub { JSON::MaybeXS->new(utf8 => 1) },
handles => {
json_encode => 'encode',
},
);
has _wh
POSIX ();
use Time::Local ();
use Time::Zone ();
use feature 'state';
sub TO_JSON { shift->strftime('%F %T%z') } # JSON::XS compatible
use overload
'bool' => sub { 1 },
'""'
ec;
use File::HomeDir;
use Readonly;
use Carp;
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON;
use URI;
use Data::Printer;
Readonly our %DEFAULTS => (
DRIP_TOKEN => undef,
DRIP_ID
if ( ref($content) ) {
$request->content_type('application/vnd.api+json');
$request->content( encode_json( $content ) );
}
$request->authorization_basic( $self->{DRIP_TOKEN},
return undef;
}
my $decoded = eval {decode_json( $result->content )};
if ( $@ ) {
$self->{debugger}->('Failed to decode JSON:', $@, $result->content);
die $result;
}
BoosterGetAttrNames( $self->_handle ) } };
}
sub TO_JSON {
my $self = shift;
my $trees = XGBoosterDumpModelEx( $self->_handle, "", 1, "json" );
return "[" . join( ',', @$trees ) . "]";
}
r as a HASHREF
=head2 TO_JSON
Serialize the booster to JSON.
This method is to be used with the option C<convert_blessed> from L<JSON>.
(See L<https://metacpan.org/pod/JSON#OBJECT-SERIALISATION>)
g (2017) many implementations are still
stuck at version 1.0/1.1 of the specification.
B<JSON>. Although JSON is popular and simple, most parsers are not round-trip.
And even if the parser were round
umentation for
L<JSON> Perl module mentions the phrase "round-trip", but it uses the phrase to
mean integrity of values, not preserving comments/whitespaces.)
Note that IOD uses JSON in places.
B<Ap
ore non-newline characters with optional encoding prefix, or
a JSON string with double quotes, or a JSON array started with "[", or a JSON
hash (object) started with "{". Encoding prefix is C<!> follo
my_variable>) will be discarded after
each run.
Returns result on success (serializable by the L<JSON> module). The result will
be discarded if the job is added as a background process.
Provides pro
(optional) C<$args> (hashref), arguments required for running the
function (serializable by the L<JSON> module)
=item * (optional, internal) job handle to be later used by send_progress()
=back
Ret
* (optional) C<$args> (hashref), arguments needed for running the
function (serializable by the L<JSON> module)
=back
Returns result (may be false of C<undef>) on success, C<die()>s on error
=cut
ed to distribution metadata under the custom
C<x_contributors> key. (e.g. in C<META.yml>, C<META.json>, etc)
If you have duplicate contributors because of differences in committer name
or email you
package MozRepl::RemoteObject;
use strict;
use Exporter 'import';
use JSON;
use Encode qw(decode);
use Carp qw(croak);
use Scalar::Util qw(refaddr weaken);
=head1 NAME
MozRepl::RemoteObject - treat
function() {
repl.linkedVars = {};
repl.linkedIdNext = 1;
};
repl.JSON_ok = function(val,context) {
return JSON.stringify({
"status":"ok",
"result": repl.wrapResults(val,
{
var res = eval(js);
return repl.JSON_ok(res,context);
} catch(e) {
//for (var x in e) { alert(x)};
return JSON.stringify({
"status":"error",
o DarkSky
package DarkSky::API;
use strict;
use warnings;
use JSON::XS;
use HTTP::Tiny;
use Moo;
our $VERSION = '1.1.5';
my $json = JSON::XS->new->pretty->canonical;
my $api = "https://api.darksk
response->{reason}\n"
unless $response->{success};
return decode_json( $response->{content} );
}
sub TO_JSON { return { %{ shift() } }; }
1;
=pod
=encoding utf-8
=head1 NAME
DarkSky
::API - Provides Perl API to DarkSky
=head1 SYNOPSIS
use DarkSky::API;
use JSON::XS;
use feature 'say';
my $lat = 43.6667;
my $long = -79.4167;
my $time = "1475363709";
eturn bridge($self)->unjson($js);
}
=head2 C<< $obj->MozRepl::RemoteObject::Methods::transform_arguments(@args) >>
This method transforms the passed in arguments to their JSON string
representations
s a Javascript string.
=cut
sub transform_arguments {
my $self = shift;
my $json = bridge($self)->json;
map {
if (! defined) {
'null'
} elsif (/^(?:[1-9][0-
id($cb)
} elsif (ref) {
$json->encode($_);
} else {
$json->encode($_)
}
} @_
};
# Helper to centralize the reblessing
aCloud::JobManager::Broker';
use Net::AMQP::RabbitMQ;
use UUID::Tiny ':std';
use Tie::Cache;
use JSON;
use Data::Dumper;
use Readonly;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init(
{
NORMAL => 1,
$MediaCloud::JobManager::Job::MJM_JOB_PRIORITY_HIGH => 2,
);
# JSON (de)serializer
my $json = JSON->new->allow_nonref->canonical->utf8;
# RabbitMQ connection credentials
has '_hos
_declare_queue( $queue_name, $durable, $declare_and_bind_exchange, $lazy_queue );
}
sub _publish_json_message($$$;$$)
{
my ( $self, $routing_key, $payload, $extra_options, $extra_props ) = @_;
use strict;
use warnings;
package App::bovespa;
use LWP::UserAgent;
use JSON;
my $agent_string = "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0";
sub new {
my ( $class ) = @
:single = 1;
my %url_params = (
q => $yahoo_query,
format => "json",
env => "store://datatables.org/alltableswithkeys",
callback => unde
$raw_html = $response->decoded_content;
}else{
die;
}
my $data = decode_json $raw_html;
return $data->{ query }{ results }{ quote }{ Bid };
}
=head1 NAME
App::bovespa