and pass them
# through
return $resp;
}
sub handle_json_content_type {
my ($self, $env, $resp) = @_;
# application/json responses really
# can't get injected into so we
#
);
}
elsif ( $content_type =~ m!^(?:application/json)! ) {
return $self->handle_json_content_type( $env, $resp );
}
# now be less spec
ess the stream and if a closing C<<body>> tag is found, inject
accordingly.
=item C<application/json>
While we have a specific handler for this content-type, we do not do
anything but just let it
qw/:config gnu_compat/;
use Pod::Usage;
GetOptions(\my %opts, qw(
help|? man verbose dump yaml json colour|color save|to_file dir=s metrics_path=s@
));
pod2usage(1) if $opts{help};
pod2usage(-exit
sult using Data::Dumper
--yaml dump result as YAML
--json dump result as JSON
--save write report (or dump) to a file
--dir
tead of displaying a report text).
=head2 --yaml
Dump the result as YAML.
=head2 --json
Dump the result as JSON.
=head3 --save
Output the result into a file instead of STDOUT.
The name of the f
es->content_type;
my @compress_types = qw(
application/javascript
application/json
application/x-javascript
application/xml
);
return 1
if ($ct =~ m
strict;
use Mojo::Autobox;
# "site.com\n"
'{"html": "<a href=\"http://site.com\"></a>"}'
->json('/html')
->dom->at('a')->{href}
->url->host
->byte_stream->say;
=head1 DESCRIPTION
Usi
for most purposes like
* string and INI processing, ZIP extracting, Base64 encoding/decoding, JSON encoding/decoding
* and so forth.
* If this directive is enabled, then all built-in Jx9 funct
ey,int nKeyLen);
UNQLITE_APIEXPORT int unqlite_kv_config(unqlite *pDb,int iOp,...);
/* Document (JSON) Store Interfaces powered by the Jx9 Scripting Language */
UNQLITE_APIEXPORT int unqlite_compile(
(unqlite_value *pVal);
UNQLITE_APIEXPORT int unqlite_value_is_json_array(unqlite_value *pVal);
UNQLITE_APIEXPORT int unqlite_value_is_json_object(unqlite_value *pVal);
UNQLITE_APIEXPORT int unqlite_va
Mojo::Collection->new(@{shift()});
}
*c = \&collection;
sub json {
require Mojo::JSON;
Mojo::JSON::encode_json(shift);
}
*j = \&json;
1;
=head1 NAME
Mojo::Autobox::Array - Autobox array meth
x;
# "a"
[qw/a b c/]->collection->first;
# '["x", "y", "z"]'
@array = (qw/x y z/);
@array->json;
=head1 DESCRIPTION
Array methods for L<Mojo::Autobox>. These methods also apply to array refer
Collection>, contructed from the elements of the invocant array.
=head2 json
Serializes the invocant array using L<Mojo::JSON/encode_json> and returns the result.
=head2 j
An alias for L</json>.
strict;
use Mojo::Autobox;
# "site.com\n"
'{"html": "<a href=\"http://site.com\"></a>"}'
->json('/html')
->dom->at('a')->{href}
->url->host
->byte_stream->say;
=head1 DESCRIPTION
Usi
package Mojo::Autobox::Hash;
use Mojo::Base -strict;
sub json {
require Mojo::JSON;
Mojo::JSON::encode_json(shift);
}
*j = \&json;
1;
=head1 NAME
Mojo::Autobox::Hash - Autobox hash methods f
ld'}->json;
=head1 DESCRIPTION
Hash methods for L<Mojo::Autobox>. These also apply to hash references.
=head1 METHODS
=head2 json
Serializes the invocant hash using L<Mojo::JSON/encode_json> and
returns the result.
=head2 j
An alias for L</json>.
}
sub json {
require Mojo::JSON;
require Mojo::JSON::Pointer;
my $data = Mojo::JSON::decode_json(shift);
return @_ ? Mojo::JSON::Pointer->new($data)->get(shift) : $data;
}
*j = \&json;
sub
e_stream->trim;
# "Text"
'<p>Text</p>'->dom->at('p')->text;
# "world"
'{"hello": "world"}'->json->{hello};
# "anchor"
'http://mysite.com/path#anchor'->url->fragment;
=head1 DESCRIPTION
Str
ead2 json
Parses the invocant string as JSON using L<Mojo::JSON/decode_json> and returns the result.
Optionally takes a JSON pointer used to delve into the resulting structure using L<Mojo::JSON::Poi
);
$self->strict_ssl(1);
$self->content_type('application/json');
$self->default_method('POST');
$self->extension('json');
$self->base_url('https://mandrillapp.com/api/1.0');
$
ats are YAML, JSON and XML. The format
is determined by the file extension, so use the appropriate one. Note
that XML::Simple is used to parse XML files and JSON::XS is used to parse
JSON files.
=ite
ify this data in a file or with a hash reference.
The currently supported file formats are YAML, JSON and XML. The format is
determined by the file extension, so use the appropriate one. Note the
XML
"Wrong space[$_].field[$fno] type: $type\n"
unless $type =~ /^(NUM|NUM64|STR|JSON|MONEY)$/
}
} else {
die "Wrong space[$_].fields\n";
}
age WWW::StationJp::API;
use 5.008005;
use strict;
use warnings;
use URI;
use LWP::UserAgent;
use JSON;
our $VERSION = "0.01";
use constant BASE_URL => 'http://www.ekidata.jp/api';
use Mouse;
sub
url = URI->new(BASE_URL."/p/".$pref->{prefcode}.".json");
my $res = $self->response($url);
$res = xml_parse($res->content);
return JSON::decode_json($res);
}
sub line{
my($self,$line) = @_;
my
url = URI->new(BASE_URL."/l/".$line->{linecode}.".json");
my $res = $self->response($url);
$res = xml_parse($res->content);
return JSON::decode_json($res);
}
sub station{
my($self,$station) = @_
7.0.0.1:11211']} );
#Set up the serialization engine (defaults to JSON)
WWW::Session->serialization_engine('JSON');
#Set up the default expiration time (in seconds or -1 for neve
vers => ['127.0.0.1'] }
],
serialization => 'JSON',
expires => 3600,
fields => {
the default serializer
__PACKAGE__->serialization_engine('JSON');
=head1 SESSION & OBJECTS
The default serialization engine is JSON, but JSON can't serialize objects by default,
you will have to wri
mon::sense;
our $VERSION = '0.200';
use AnyEvent;
use AnyEvent::Util;
use AnyEvent::Handle;
use JSON::XS;
use File::ShareDir;
use Scalar::Util;
use Alien::Thrust;
use Thrust::Window;
our $THRUST
($level, $msg_cb, $to_dump, $indent) = @_;
return if $level > $ENV{THRUST_DEBUG};
$js ||= JSON::XS->new->pretty->canonical;
my $out = "\n" . $msg_cb->() . "\n";
$out .= $js->encode($to_d
my $line_handler; $line_handler = sub {
my ($hdl, $line) = @_;
my $msg = eval { decode_json($line) };
if (defined $msg) {
debug(1, sub { "<<<<<<<<<<<<<<<<< Message from thrust s
>user_agent(__PACKAGE__ . ' ' . $WebService::Desk::VERSION);
$self->content_type('application/json');
$self->base_url('https://' . $self->user . '.desk.com/api/v2');
$self->auth_type('oaut
dentials;
use HTTP::Tiny;
use JSON::XS;
use Catmandu::Util qw(is_value);
with 'Catmandu::Importer';
my $DOCUMENT_CONTENT_TYPE = 'application/vnd.mendeley-document.1+json';
my $CATALOG_SEARCH_PATH =
th?$params", {
headers => {
Accept => $DOCUMENT_CONTENT_TYPE,
Authorization => sprintf(q{Bearer %s}, $token)
}
});
decode_json($res->{content});
}
1;
tfile';
use TntCompat::Cat::SnapMsgpack;
use TntCompat::Cat::Snap;
use TntCompat::Cat::Xlog;
use JSON::XS;
use File::Basename 'basename';
use feature 'state';
sub strhex($) {
my ($str) = @_;
$res[ $fno ];
}
} elsif ('JSON' eq uc $ftype) {
# TODO: decode str
$res[ $fno ] = JSON::XS->new->decode($res[ $fno ] );
} elsi
string $_->[2];
}
} elsif ('JSON' eq uc $type) {
# TODO: decode str
$_->[2] = JSON::XS->new->decode($_->[2] );
} else {
e =~ /\.json$/i)
? $self->_load_json($file_name)
: ($file_name =~ /\.xml$/i)
? $self->_load_xml($file_name)
: die "Expected '$file_name' to end with .yaml, .json or .xm
ile(shift);
}
sub _load_json {
my $self = shift;
require JSON::XS;
my $json = do { local $/; open my $json, '<', shift; <$json> };
JSON::XS::decode_json($json);
}
sub _load_xml {
ds to an absolute path of C<./lib>.
=item C<meta>
Only find modules listed as prereqs in C<META.json> or C<META.yaml>. Also
finds modules that are prereqs of those modules.
=item C<none>
Use this