);
use BusyBird::DateTime::Format;
use Storable qw(dclone);
use Carp;
use List::Util qw(min);
use JSON;
use Try::Tiny;
sub new {
my ($class, %options) = @_;
my $self = bless {
timelin
lepath to write.");
return 0;
}
my $success;
try {
print $file encode_json($self->{timelines});
$success = 1;
}catch {
my $e = shift;
$self->_lo
ccess;
try {
my $text = do { local $/; <$file> };
$self->{timelines} = decode_json($text);
$success = 1;
}catch {
my $e = shift;
$self->_log("error", "E
qw(set_param split_with_entities);
use Carp;
use Try::Tiny;
use Scalar::Util qw(weaken);
use JSON qw(to_json);
use Text::Xslate qw(html_builder html_escape);
use File::Spec;
use Encode ();
use JavaScr
te => 'error.tx', args => {error => $message},
code => $http_code
);
}
sub response_json {
my ($self, $res_code, $response_object) = @_;
my $message = try {
die "response
}
to_json($response_object, {ascii => 1})
}catch {
undef
};
if(defined($message)) {
return [
$res_code, ['Content-Type' => 'application/json; charset=ut
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) = @_
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 {
'0.4';
use strict;
use warnings;
use LWP::UserAgent;
use Ceph::RadosGW::Admin::HTTPRequest;
use JSON;
use Moose;
use URI;
use URI::QueryParam;
use Ceph::RadosGW::Admin::User;
use namespace::autoclea
thod, $path, %args) = @_;
my $content = '';
my $query_string = _make_query(%args, format => 'json');
my $request_builder = Ceph::RadosGW::Admin::HTTPRequest->new(
method => $method,
pa
line, $res->content, $req->as_string);
}
if ($res->content) {
my $data = eval {
JSON::decode_json($res->content);
};
if (my $e = $@) {
die "Could not deserialize server response:
/timelines/home/statuses.json
C<< POST /timelines/home/statuses.json >> endpoint inputs statuses to the "home" timeline.
Statuses are in the HTTP request body, encoded in JSON.
You can input more th
o, Alice!", "user":{"screen_name":"Bob"}}]' \
http://127.0.0.1:5000/timelines/home/statuses.json
This time, the statuses have C<user.screen_name> fields.
L<BusyBird> renders this field as the p
bird_input_feed https://metacpan.org/feed/recent -p http://127.0.0.1:5000/timelines/home/statuses.json
=back
After that, you can see the imported feed items (in this case, Perl modules recently uplo
quests with the message body,
data format of the body must be JSON encoded by UTF-8,
so C<Content-Type> header should be C<application/json; charset=utf-8>.
The data format of HTTP responses is deter
=item C<timeline> = STR (required)
Timeline name.
=item C<format> = {json,html} (required)
Response format. It is either C<json> or C<html>.
If C<html> format is specified, the response message is
s C<json>.
It is useful when you transfer statuses from one L<BusyBird> instance to another.
=back
B<Response>
In success, the HTTP response code is 200.
=over
=item *
If C<format> is C<json> an
BusyBird::Manual::Status - Status object specification
=head1 SYNOPSIS
use JSON;
my $status = decode_json(<<'STATUS');
{
"id": "http://api.example.com/2291",
"create
in JSON format). It should be serializable to
JSON and deserializable from JSON.
=head1 FIELDS
The following fields in a status object is used by BusyBird.
Note that the following list uses JSON f
_or sql_lt sql_le sql_raw);
use BusyBird::DateTime::Format;
use BusyBird::Util qw(set_param);
use JSON;
use Scalar::Util qw(looks_like_number);
use DateTime::Format::Strptime;
use DateTime;
no autoviv
>{created_at});
$record->{content} = to_json($status);
return $record;
}
sub _from_status_record {
my ($record) = @_;
my $status = from_json($record->{content});
$status->{id} = $
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
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;
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
d it's tests/attachments in an array of HASHREFs.
The idea would be that you then could encode as JSON/XML as a backup, or to facilitate migration to other systems.
The project hashes will be what yo
Web::Dash::Lens;
use Encode;
use Future::Q 0.012;
use AnyEvent::DBus 0.31;
use AnyEvent;
use JSON qw(to_json);
use Try::Tiny;
use Carp;
my $index_page_template = <<'EOD';
<!DOCTYPE html>
<html>
<he
ng) {
return $.ajax({
url: "search.json",
data: { lens: lens_name, q: query_string },
dataType: "json",
type: 'GET',
}).then(null, funct
in'],
[Encode::encode('utf8', $error)]
]);
});
};
}
sub _json_response {
my ($response_object, $code) = @_;
if(!defined($code)) {
$code = $resp
Path, ["param1=$param1", "param2=$param2", ..]);
use Data::Dump qw(dump);
use JSON;
my $json = new JSON;
dump $json->decode($result);
=head1 DESCRIPTION
The module to connect to the api of the
I method C<$restPath> (with the given C<$params>, where applicable) and returns either undef or a JSON string.
=back
=head1 DEPENDENCIES
=over 8
=item L<WWW::Mechanize>
=item L<HTTP::Request>
=i
OBJET : Exemple d'utilisation de CTM::ReadEM : simple recuperation des services du BIM au format JSON
# APPLICATION : ControlM
# AUTEUR : Yoann Le Garff
# DATE DE CREATION : 20/07/2014
#-------------
use warnings;
use strict;
use Getopt::Long;
use File::Basename qw/basename/;
use Try::Tiny;
use JSON;
use CTM::ReadEM 0.181, qw/:all/;
#----> ** fonctions **
sub usage() {
return 'Aide : perld
service_name => sub {
shift =~ $opts{f}
}
});
}
print JSON->new()->utf8()->pretty()->encode($servicesObj->getItems()) . "\n";
} else {
die $err;
}
exit
e Labyrinth::Variables;
use Crypt::Lite;
use Digest::SHA1 qw(sha1_hex);
use HTML::Entities;
use JSON;
use Time::Local;
use WWW::Mechanize;
#---------------------------------------------------------
ODS
=over 4
=item LoadUsers
Builds the API call to retrieve the users, and stores the returned JSON into
the database, referencing all the users within Act, who have been recorded as
a speaker and/
LoadTalks
Builds he API call to retrieve the talks for the conference event. Parses the
returned JSON, filtering the talks based on day, room and type into specific
categories and stores within the d
ge Mojo::JSONXS;
# ABSTRACT: provide faster JSON for Mojolicious apps using Cpanel::JSON::XS
use Cpanel::JSON::XS;
use Mojo::JSON;
use Mojo::Util 'monkey_patch';
my $BINARY = Cpanel::JSON::XS->new
el::JSON::XS->new->utf8(0)->allow_nonref(1)->allow_blessed(1)->convert_blessed(1);
monkey_patch 'Mojo::JSON', 'encode_json', sub { $BINARY->encode(shift) };
monkey_patch 'Mojo::JSON', 'decode_json',
atch 'Mojo::JSON', 'to_json', sub { $TEXT->encode(shift) };
monkey_patch 'Mojo::JSON', 'from_json', sub { $TEXT->decode(shift) };
monkey_patch 'Mojo::JSON', 'true()', sub { Cpanel::JSON::XS::true(
------------------------------------------------------
# Library Modules
use WWW::Mechanize;
use JSON::XS;
#----------------------------------------------------------------------------
# Variables
$mech->content;
}
sub _parse {
my $self = shift;
my $data;
eval { $data = decode_json($self->{content}) };
return $data unless($@ || !$data);
$self->{error} = $@ || 'no da
N
This document describes Web API provided by L<Web::Dash>.
=head1 ENDPOINT
=head2 GET /search.json
Makes a search with a Lens and returns the search results.
B<Query Parameters>
=over
=item C<
onse is a JSON object.
The C<error> attribute of the object is C<null>,
and the C<results> attribute of the object is an array of search results.
Each entry in the C<results> array is a JSON object r
response is a JSON object.
The C<error> attribute of the object describes the cause of the error.
B<Example>
Request to L<Wikipedia|http://en.wikipedia.org/> Lens.
GET /search.json?lens=net.lau