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:
ces/rest/';
bless $self, $class;
$self->{api_args}->{format} = 'json';
$self->{api_args}->{nojsoncallback} = 1;
$self->method('POST');
$self->uri( $self->{rest_uri} );
shift;
$str =~ s!^!// !g;
$str;
}
sub eval_expr_js {
require File::Temp;
require JSON::MaybeXS;
require Language::Expr::Compiler::js;
require Nodejs::Util;
my ($expr, $op
@_;
$opts //= {};
state $default_jsc = Language::Expr::Compiler::js->new;
state $json = JSON::MaybeXS->new->allow_nonref;
my $jsc = $opts->{js_compiler} // $default_jsc;
# code
lare vars\n") . join("", map { "let $_ = ".$json->encode($opts->{vars}{$_}).";\n" } sort keys %{$opts->{vars}})
: ""),
"console.log(JSON.stringify(",
$jsc->compile($expr),
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
get '/html' => sub {
send_as html => template 'foo';
};
get '/json/**' => sub {
send_as json => splat;
};
=head1 DESCRIPTION
This plugin is DEPRECATED. The C<send_as>
#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;
}
_parent => $self,
_type => $self->_termType->insert,
args => Rethinkdb::Util->_expr_json($args),
optargs => $params,
);
return $q;
}
sub sync {
my $self = shift;
my $q = R
st')->table('dc_universe')->create->run;
Create this table. A RethinkDB table is a collection of JSON documents.
If successful, the operation returns an object: C<< {created => 1} >>. If a
table wit
('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
= '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
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
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 } = $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;
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
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
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
}
}
\%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:
>{_rdb};
return $q;
}
sub json {
my $self = shift;
my $value = shift;
my $q = Rethinkdb::Query->new(
_rdb => $self,
_type => $self->term->termType->json,
args => $value,
);
optargs,
);
return $q;
}
sub geojson {
my $self = shift;
my $args = shift;
my $q = Rethinkdb::Query->new(
_type => $self->term->termType->geojson,
args => $args,
);
return $
t error.
=head2 expr
r->expr({a => 'b'})->merge({b => [1,2,3]})->run($conn);
Construct a RQL JSON object from a native object.
=head2 js
r->js("'str1' + 'str2'")->run($conn);
r->table('marv
sub { shift->recipe->calc },
);
method TO_JSON {
+{ recipe => $self->recipe }
}
with 'App::vaporcalc::Role::Store';
1;
=pod
=for Pod::Coverage TO_JSON
=head1 NAME
App::vaporcalc::RecipeResult
ill,
);
return $q;
}
sub to_geojson {
my $self = shift;
my $q = Rethinkdb::Query->new(
_parent => $self,
_type => $self->_termType->to_geojson,
);
return $q;
}
sub includes
a single JSON result, or a cursor,
depending on the query.
=head2 update
r->table('posts')->get(1)->update({status => 'published'})->run;
Update JSON documents in a table. Accepts a JSON document
=> 'Aleas jacta est',
status => 'draft'
})->run;
Replace documents in a table. Accepts a JSON document or a ReQL expression, and
replaces the original document with the new one. The new docum
package Rethinkdb::Response;
use Rethinkdb::Base -base;
use JSON::PP;
use Rethinkdb::Protocol;
has [qw{ type type_description response token error_type backtrace profile }];
sub _init {
my $class