use HTML::FormFu::ExtJS 0.076;
use Path::Class;
use HTML::Entities;
use Lingua::EN::Inflect;
use JSON;
use Try::Tiny;
use Moose::Util::TypeConstraints;
subtype 'PathClassDir', as 'Path::Class::Dir';
'stash_key'}
)
|| 'rest';
my $output;
eval { $output = encode_json( $c->stash->{$stash_key} ); };
$c->res->content_type('text/html');
$c->res->outp
({ ... });
1;
# set the Accept header to 'application/json' globally
Ext.Ajax.defaultHeaders = {
'Accept': 'application/json'
};
=head1 DESCRIPTION
This controller will make CRUD op
MPRPC::Client instance
sub get_client {
my ($self) = @_;
return $self->{client};
}
# Get JSON configure data from Jubatus server
sub get_config {
my ($self) = @_;
my $retval = $self->
[],
[],);
return $retval;
}
# Get JSON status data from Jubatus server
sub get_status {
my ($self) = @_;
my $retval = $self->_ca
},
accepted_content_types => ['application/json'],
content_types => ['application/json'],
content_type => 'application/json'
);
};
# split a request in multiple requests
dAttributes;
use List::Util qw(first);
use List::MoreUtils ();
use Scalar::Util qw(blessed);
use JSON ();
use CatalystX::Controller::ExtJS::Direct::Route;
__PACKAGE__->config(
action => {
=> 'router' },
src => { Local => undef },
},
default => 'application/json'
);
has 'api' => ( is => 'rw', lazy_build => 1 );
has 'routes' => ( is => 'rw', isa => 'H
actions => $data
};
}
sub encoded_api {
my ( $self, $c ) = @_;
return JSON::encode_json( $self->set_namespace( $self->api, $c ? $c->req->params->{namespace} : () ) );
}
sub rout
er_name - String value to uniquely identify a task in the ZooKeeper
cluster
Output:
- JSON file formated string - Returns a server configuration from a server.
This configuration is
er_name - String value to uniquely identify a task in the ZooKeeper
cluster
Output:
- JSON file formated string - Returns a server configuration from a server.
This configuration is
;
BEGIN { extends 'Catalyst::Controller' };
with 'CatalystX::Controller::ExtJS::Direct';
use JSON::XS;
sub add : Chained('/') : Path : CaptureArgs(1) {
my($self,$c, $arg) = @_;
$c->stas
: DirectArgs(1) {
my ($self, $c) = @_;
$c->res->content_type('application/json');
$c->res->body(encode_json($c->req->data));
}
As you can see the C<add_to> action has the C<Direct> attri
which is always an arrayref and includes all arguments.
We set the content type to C<application/json> to make sure that the
body is not serialized twice. That is, if you would not set the content ty
$c->req->is_ext_upload )
{
unshift(@{$c->req->accepted_content_types}, 'application/json');
return 1;
}
else {
return $self->next::method( $controller, $c );
CT: Sets the request method via a query parameter
use Moose::Role;
use namespace::autoclean;
use JSON::XS;
#has 'is_ext_upload' => ( isa => 'Bool', is => 'rw', lazy_build => 1 );
sub is_ext_upload
^multipart\/form-data/
&& ( !$self->{content_type} || $self->{content_type} ne 'application/json');
}
around 'method' => sub {
my ( $orig, $self, $method ) = @_;
return $self->$orig($me
er_name - String value to uniquely identify a task in the ZooKeeper
cluster
Output:
- JSON file formated string - Returns a server configuration from a server.
This configuration is
use JSON::XS ();
use POSIX qw(locale_h);
BEGIN {
our (@EXPORT, @EXPORT_OK);
@EXPORT = qw(
html_encode html_decode uri_escape check_email idn_to_unicode get_domain to_json from_json for
e {
return;
}
}
=head2 to_json
B<Arguments:>
=over
=item
B<$data> - scalar.
=back
B<Return value:> string, C<$data> as JSON.
=cut
sub to_json($;%) {
my ($data, %opts) = @_;
my $res;
if ($opts{'pretty'}) {
$res = JSON::XS->new->utf8->allow_nonref->pretty->encode($data);
} else {
$res = JSON::XS->new->utf8->allow_nonref->encode($data);
}
se JSON::Any;
use Carp qw(croak);
use POSIX qw(strftime);
use HTTP::Request;
use File::XDG;
use File::Spec;
use HTTP::Cookies;
use HTML::Entities qw(decode_entities);
use Try::Tiny;
my $json = JSON::
e?";
$url .= "start=$start&end=$end";
$self->agent->get($url);
# Decode JSON
my $data = $json->decode( $self->agent->content );
# Decode HTML entities.
foreach my $record
w));
my $text = $args{text} or croak "set_done requires a 'text' argument";
my $done_json = $json->encode({
calendar => $self->user,
owner => $self->user,
er_name - String value to uniquely identify a task in the ZooKeeper
cluster
Output:
- JSON file formated string - Returns a server configuration from a server.
This configuration is
e Geo::Coder::Cloudmade;
our $VERSION = '0.7';
use strict;
use Carp qw(croak);
use Encode;
use JSON::Syck;
use HTTP::Request;
use LWP::UserAgent;
use URI;
sub new {
my $class = shift;
my
e "Cloudmade API returned error: " . $res->status_line;
}
local $JSON::Syck::ImplicitUnicode = 1;
my $data = JSON::Syck::Load( $res->content );
my $results = [];
foreach my $poi
kingInfo;
use warnings;
use strict;
our $VERSION = '1.0105';
use 5.006;
use LWP::UserAgent;
use JSON::PP qw//;
use base 'Class::Accessor::Grouped';
__PACKAGE__->mk_group_accessors( simple => qw/
( $z ) = $content =~ m{var jsHistoryTable = (\[.+?\]);}s;
my $history_table = eval {
JSON::PP->new->allow_singlequote->decode( $z );
};
$@
and return $self->_set_error(
_links_into_model parse_links_to_rdfjson parse_links_to_list parse_single_link relationship_uri/],
'standard' => [qw/parse_links_into_model parse_links_to_rdfjson/],
);
our @EXPORT_OK = @{ $EXPORT
el->add_hashref(parse_links_to_rdfjson($response));
return $model;
}
sub parse_links_to_rdfjson
{
my ($response) = @_;
croak "Parameter to parse_links_to_rdfjson should be an HTTP::Message."
u
a
new, empty model is created.
=item C<< parse_links_to_rdfjson($response) >>
Returns a hashref with a structure inspired by the RDF/JSON
specification. This can be thought of as a shortcut for:
se JSON;
use Data::Dumper;
Getopt::Compact::WithCmd->add_type(JSON => Str => sub { decode_json(shift) });
my $go = Getopt::Compact::WithCmd->new(
global_struct => {
from_json =>
{
type => 'JSON',
},
},
);
my $data = $go->opts->{from_json};
print Dumper $data;
# will run cmd:
$ ./add_type.pl --from_json '{"foo":"bar"}'
$VAR1 = {
our $VERSION = "0.01";
our @HERE_QUEUE;
our $SELF;
# JKML is based on JSON::Tiny.
# JSON::Tiny was "Adapted from Mojo::JSON and Mojo::Util".
# Licensed under the Artistic 2.0 license.
# http://ww
uote}]|\\(?:[${quote}\\/bfnrt]|u[0-9a-fA-F]{4})){0,32766})*)!gc; # segfault on 5.8.x in t/20-mojo-json.t #83
my $str = $1;
# Invalid character
unless (m/\G${quote}/gc) {
_exception('Unexpec
his module is alpha state. Any API will change without notice.>
=head2 What's difference between JSON?
JKML extends following features:
=over 4
=item Raw strings
=item Comments
=back
These feat
{
$WebService::Diffbot::VERSION = '0.003';
}
use Moo;
use namespace::clean;
use JSON qw( decode_json encode_json );
use LWP::UserAgent;
has api_url => ( is => 'ro', default => sub { 'http://api.d
serAgent->new->get($uri);
die $response if !$response->is_success;
my $content = decode_json $response->decoded_content;
die $content->{error} if $content->{error};
print STDERR $co
aders>
=head2 C<http_engine>
=begin MetaPOD::JSON v1.1.0
{
"namespace":"Net::Minecraft::Role::HTTP",
"interface":"role"
}
=end MetaPOD::JSON
=head1 AUTHOR
Kent Fredric <kentnl@cpan.org>