d TO_JSON {
+{
percentage => $self->percentage,
tag => $self->tag,
type => $self->type,
}
}
with 'App::vaporcalc::Role::Store';
1;
=pod
=for Pod::Coverage TO_JSON
=he
is);
# prefix
$self->prefix($self->key ? $self->key : 'socket.io');
}
sub json { $_[0]->flags->{json} = 1; $_[0]; }
sub volatile { $_[0]->flags->{volatile} = 1; $_[0]; }
sub bro
}
}
\%params
}
method TO_JSON {
+{
map {;
my ($attr, $val) = ($_, $self->$_);
my $raw = blessed $val && $val->can('TO_JSON') ? $val->TO_JSON : $val;
$attr => $raw
ole::Calc',
'App::vaporcalc::Role::Store' ;
1;
=pod
=for Pod::Coverage BUILD BUILDARGS TO_JSON
=head1 NAME
App::vaporcalc::Recipe - An e-liquid recipe
=head1 SYNOPSIS
use App::vaporcalc:
ber, Null and Boolean. Perl lacks native
Boolean support.
Data interchange modules like YAML and JSON can now C<use boolean> to
encodeI<decode>roundtrip Boolean values.
=head1 FUNCTIONS
This module
ecated.
=head1 JSON SUPPORT
JSON::MaybeXS (or less preferably JSON.pm ) will encode Perl data with
boolean.pm values correctly if you use the C<convert_blessed> option:
use JSON::MaybeXS;
u
se boolean -truth;
my $json = JSON::MaybeXS->new->convert_blessed;
say $json->encode({false => (0 == 1)}); # Says: '{"false":false}',
=head1 AUTHOR
Ingy döt Net <ingy@cpan.org>
=head1
calc::Cmd::Result->new(%params)
}
method munge_recipe (%params) {
my $data = $self->recipe->TO_JSON;
$data->{$_} = $params{$_} for keys %params;
App::vaporcalc::Recipe->new(%$data)
}
1;
=pod
y $new_recipe = $self->munge_recipe(
target_vg => 50,
target_pg => 50
);
Calls C<TO_JSON> on the current L</recipe> object, merges in the
given key/value pairs, and returns a new L<App::
= '0.005004';
use Defaults::Modern;
use JSON::MaybeXS 1.001 ();
use Role::Tiny;
requires 'TO_JSON';
method save ( (Str | Path) $path ) {
my $jseng = JSON::MaybeXS->new(
utf8 => 1,
1,
);
my $json = $jseng->encode($self)
|| confess "Could not encode JSON: ".$jseng->error;
path($path)->spew_utf8($json)
}
method load ( (Str | Path) $path ) {
my $json = path($path)
->slurp_utf8;
my $jseng = JSON::MaybeXS->new(
utf8 => 1,
relaxed => 1,
);
my $data = $jseng->decode($json)
|| confess "Could not decode JSON: ".$jseng->error;
$self->_loa
0 } = $false;
${ \ !!1 } = $true;
# make true and false read-only again
&Internals::SvREADONLY( \ !!0, 1);
&Internals::SvREADONLY( \ !!1, 1);
}
sub TO_JSON { ${$_[0]} ? \1 : \0 }
1;
ame database ssl json)],
);
use Carp;
use Data::Validator;
use Mouse::Util::TypeConstraints;
use Furl;
use URI::Escape;
use JSON 2;
enum 'TimePrecision' => qw(s m u);
subtype 'JSONBool' => as 'Scal
rRef';
coerce 'JSONBool'
=> from 'Bool' => via { $_ ? \1 : \0 }
=> from 'Object' => via { JSON::is_bool($_) ? ($_ == 1 ? \1 : \0) : \0 }
;
sub new {
state $rule = Data::Validator->new(
oin('/', __PACKAGE__, $VERSION),
timeout => $args->{timeout},
),
json => JSON->new,
status => {},
%$args
}, $class;
return $self;
}
sub debugf {
package Rethinkdb::Util;
use Rethinkdb::Base -base;
use Scalar::Util 'blessed';
use JSON::PP 'encode_json';
use Carp 'croak';
use Rethinkdb::Query::Datum;
use Rethinkdb::Protocol;
my $PROTOCOL = Re
mostly JSON
sub _expr_json {
my $self = shift;
my $value = shift;
if ( blessed($value) && $value->can('_build') ) {
return $value;
}
my $retval;
eval { $retval = encode_json $value
( !$@ && $retval ) {
return Rethinkdb::Query->new(
_type => $PROTOCOL->term->termType->json,
args => $retval
);
}
elsif ( ref $value eq 'ARRAY' ) {
return $self->_make_ar
package HelloWorld::Resource;
use strict;
use warnings;
use JSON::XS qw[ encode_json ];
use parent 'Web::Machine::Resource';
sub init {
my $se
$self->{json}
= exists $args->{json}
? $args->{json}
: {};
}
sub content_types_provided { [ { 'application/json' => 'to_json' } ] }
sub to_json {
my $self = shift;
encode_json( $self->{json} );
}
}
Web::Machine->new(
resource => 'HelloWorld::Resource',
resource
Exporter 'import';
@EXPORT = qw/profile trophies/;
use strict;
use warnings;
use HTTP::Tiny;
use JSON;
use constant ORIGIN => 'https://www.playstation.com';
use constant IO
url<. :(\n" unless $response->{success};
my $json_data = $response->{content};
$json_data =~ s/^\s+|\s+$//g;
return JSON::decode_json($json_data);
}
1;
=pod
=encoding UTF-8
=head1 NAME
onse = Weather::OpenWeatherMap::Result->new_for(
$type =>
request => $my_request,
json => $content,
);
unless ($my_response->is_success) {
my $code = $my_response->respon
::More (0.88) -> core
IO::Socket (0) -> core
Socket (1.97) -> core
JSON::PP (2.27103) -> MAKAMAKA/JSON-PP-2.27400
ExtUtils::MakeMaker (0) -> core
ExtUtils::MakeMaker (0) ->
P/PE/PEVANS/IO-Socket-IP-0.37.tar.gz
M/MA/MAKAMAKA/JSON-PP-2.27400.tar.gz
P/PE/PEVANS/IO-Socket-IP-0.37.tar.gz
M/MA/MAKAMAKA/JSON-PP-2.27400.tar.gz
=head1 DESCRIPTION
This is experimenta
use 5.008001;
use strict;
package Parse::CPAN::Meta;
# ABSTRACT: Parse META.yml and META.json CPAN metadata files
our $VERSION = '1.4422';
use Exporter;
use Carp 'croak';
our @ISA = qw/Exporter/;
o
($meta);
}
elsif ($filename =~ /\.json$/) {
return $class->load_json_string($meta);
}
else {
$class->load_string($meta); # try to detect yaml/json
}
}
sub load_string {
my ($class
lass->load_yaml_string($string);
}
elsif ( $string =~ /^\s*\{/ ) { # looks like JSON
return $class->load_json_string($string);
}
else { # maybe doc-marker-free YAML
return $class->load
er 'import';
use Carp qw(croak);
{ our @Bool = (bless( do{\(my $o = 0)},'JSON::PP::Boolean'), bless( do{\(my $o = 1)},'JSON::PP::Boolean'));
local $@;
eval {
require Types::Serialiser;
ialiser::false(), Types::Serialiser::true());
1
} or
eval {
require JSON::XS;
@Bool = (JSON::XS::false(), JSON::XS::true());
1
};
};
# Items to export into callers namespace by defa
# JSON::XS boolean support
use JSON::XS;
$json = encode_json( thaw( $amf0, parse_serializator_option( 'json_boolean' ))); #
$amf_with_boolean = freeze( $JSON::XS::true or $JSON::XS:
#define OPT_RAISE_ERROR 8
#define OPT_MILLSEC_DATE 16
#define OPT_PREFER_NUMBER 32
#define OPT_JSON_BOOLEAN 64
#define OPT_MAPPER 128
#define OPT_TARG 256
#define OPT_SKIP_BAD
' ){
if ( sv_isa(one, "JSON::PP::Boolean")){
is_perl_bool = 1;
}
else if ( sv_isa(one, "JSON::XS::Boolean") ){
_ struct io_struct *io, bool value){
AV *Bool;
SV *sv;
if ( 0 == ( io->options & OPT_JSON_BOOLEAN ) ){
sv = boolSV( value );
/* SvREFCNT_inc_simple_void_NN( sv ); */
return sv;
}
ported since JavaScript 1.6], 'let' lexical variables
[supported since JavaScript 1.7] and native JSON [supported since JavaScript
1.8.1]).
To test emitted JavaScript code, we use Node.js.
=item * J
package API::PureStorage;
use Data::Dumper;
use REST::Client;
use JSON;
use Net::SSL;
use warnings;
use strict;
$API::PureStorage::VERSION = '0.03';
our %ENV;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} =
$client->setHost('https://'.$self->{host});
$client->addHeader('Content-Type', 'application/json');
$client->getUseragent()->cookie_jar({ file => $self->{cookie_file} });
$client->getUs
_json($con)), "\n" if $debug;
return from_json($con);
}
sub _api_post {
my $self = shift @_;
my $url = shift @_;
my $data = shift @_;
my $ret = $self->{client}->POST($url, to_json
use strict; use warnings;
use Benchmark 'cmpthese';
use JSON::Tiny ();
use JSON::PP 'encode_json', 'decode_json';
use Text::ZPL;
my $struct = +{
foo => 'bar',
bar => 'baz',
hash => +{
x =>
[ 1 .. 100 ],
},
};
my $tiny = JSON::Tiny->new;
my ($js, $tjs, $zpl);
cmpthese( 2_000, +{
encode_jsonpp => sub {
$js = encode_json $struct
},
encode_jsontiny => sub {
$tjs = $tiny->e
b {
$zpl = encode_zpl $struct
},
});
cmpthese( 2_000, +{
decode_jsonpp => sub {
decode_json $js
},
decode_jsontiny => sub {
$tiny->decode($tjs)
},
decode_zpl => sub {
deco
('test')->table_create('dc_universe')->run;
Create a table. A RethinkDB table is a collection of JSON documents.
If successful, the operation returns an object: C<< {created => 1} >>. If a
table wit