tmandu> command line client can be used like this:
catmandu import JSON to DBI --data_source SQLite:mydb.sqlite < data.json
=head1 DESCRIPTION
A Catmandu::Store::DBI is a Perl package that can
:ChromeLogger;
use parent 'Plack::Middleware';
use Plack::Util;
use Plack::Util::Accessor qw/
json_encoder
enable_in_production
disabled
/;
our $VERSION = '0.01';
sub prepare_app {
m
sabled ) {
$env->{'psgix.chrome_logger'} = Web::ChromeLogger->new(
json_encoder => $self->json_encoder,
);
}
my $res = $self->app->($env);
$self->response_cb(
d1 METHODS
=over
=item prepare_app
=item call
=back
=head1 MIDDLEWARE OPTIONS
=over
=item json_encoder
pass to L<Web::ChromeLogger>. Who need to set this parameter ?
=item enable_in_producti
okenized JSON
Using modules:
=over
=item *
L<Pistachio::Language>
=item *
L<https://github.com/joeldalley/lib-JBD> (JBD::JSON).
=back
In this example, JBD::JSON is used to parse JSON text int
n types JBD::JSON produces to CSS definitions.
use strict;
use warnings;
use Pistachio;
use Pistachio::Token;
use Pistachio::Language;
use JBD::JSON 'std_parse';
# Argument: JSON input text.
Returns arrayref of Pistachio::Tokens.
my $tokens = sub {
my $tokens = std_parse 'json_text', $_[0];
[map Pistachio::Token->new($_->type, $_->value), @$tokens];
};
# Argument: a token t
rk;
{
$Form::Toolkit::Clerk::VERSION = '0.008';
}
use Moose;
use DateTime::Format::ISO8601;
use JSON;
has 'source' => ( required => 1 , is => 'ro' );
has '_date_parser' => ( is => 'ro' , default =
);
$self->strict_ssl(1);
$self->content_type('application/json');
$self->default_method('POST');
$self->extension('json');
$self->base_url('https://' . $self->dc . '.api.mailchimp.
$Opsview::REST::APICaller::VERSION = '0.013';
}
use Moo::Role;
use Carp;
use Try::Tiny;
use JSON ();
use HTTP::Tiny 0.014;
has ua => (
is => 'ro',
default => sub { HTTP::Tiny->new(
'Accept' => 'application/json',
'Content-type' => 'application/json',
}; },
);
has json => (
is => 'ro',
default => sub { JSON->new },
);
sub get {
my $self
=> $self->headers,
});
croak $self->_errmsg($r) unless $r->{success};
return $self->json->decode($r->{content});
}
sub delete {
my $self = shift;
my $r = $self->ua->delete($self
se warnings;
use Carp qw(carp croak);
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use JSON::XS;
our $VERSION = '0.02';
=over
=item new (%config)
Constructor. You can set the following
t the complete URL
$self->{'url'} = $self->{'baseurl'} . '/authkey=' . $self->{'authkey'} . '/json';
# Exit if HTTPS requested, but LWP::Protocol::https not found
if ($self->{'baseurl'} =
n/icinga-web-api.html for
details on how filters need to be defined. Basically, they define it in JSON
syntax, but this module requires a Perl hash reference instead.
Simple Example:
$api->set_fil
$self = shift;
require JSON;
my $uri = Opsview::REST::Config->new(
$obj_type,
json_filter => JSON::encode_json({@_}),
);
req = HTTP::Request->new();
$req->method('GET');
$req->uri($uri);
#$req->content( to_json($content) ) if ($content);
my $ua = LWP::UserAgent->new();
my $res = $ua->request($req)
rce::API::Client;
use strict;
use warnings;
use Encode qw( decode_utf8 );
use JSON::Parse qw( json_to_perl );
use JSON::XS;
use MIME::Base64;
use REST::Client;
use Try::Tiny;
use URI::Escape qw( uri
f, %opts) = @_;
if ($opts{method} =~ /^(POST|PUT)$/) {
$opts{data} = encode_json($opts{data}) if $self->{sendJSON};
} else {
$opts{data} = '';
}
return %opts;
}
sub _parse_headers {
id};
}
if ($opts{method} =~ /^(POST|PUT)$/) {
if ($self->{sendJSON}) {
$headers->{'Content-type'} = 'application/json;charset=UTF-8';
} else {
$headers->{'Content-type'} = 'app
t. Suggestions are returned as a tree
of hash and list references that correspond to the returned JSON data
structure. The most important parameters and result elements are described bellow.
For the f
ethod;
use warnings;
use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
use Encode;
use JSON;
our $VERSION = '0.7';
my $SERVICE_TYPE = "rest";
my $API_VERSION = "0.0";
my $UA_SUFFIX = "Pe
shift;
my %params = @_;
my %merged_params = ( 'method' => $self->{METHOD},
'format' => 'json',
'api_key' => $self->{APIKEY},
%params );
my $response = $self->{ua}->request(POST $se
->is_success) {
$self->{error} = $response->status_line;
return undef;
}
my $result = from_json($response->content);
if ($result->{status} ne 'ok') {
$self->{error} = "method returned " . $
:Plugin::Notify::PagerDuty;
use 5.010;
use Mouse::Role;
use LWP::UserAgent;
use URI::Escape;
use JSON;
use Data::Dumper;
# ABSTRACT: Plugin for TheEye to raise alerts in Pager Duty
#
our $VERSION =
required => 1,
default => 'https://events.pagerduty.com/generic/2010-04-15/create_event.json',
);
has 'pd_err' => (
is => 'rw',
isa => 'HashRef',
required => 0,
T');
$req->uri($self->pd_url);
$req->header('Content-Type' => 'application/json');
$req->content( to_json($content) ) if ($content);
my $ua = LWP::UserAgent->new();
my $res = $u
Geo::Coder::PlaceFinder;
our $VERSION = '0.1';
use strict;
use Carp qw(croak);
use Encode;
use JSON;
use LWP::UserAgent;
use Net::OAuth;
use URI;
$Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOC
s_error ) {
die "PlaceFinder API returned error: " . $res->status_line;
};
my $data = decode_json( $res->content );
my $response = $data->{bossresponse}->{placefinder}->{results}->[0];
my $re
t::More;
use JSON;
# ABSTRACT: Graphite plugin for TheEye
#
our $VERSION = '0.5'; # VERSION
has 'json' => (
is => 'rw',
isa => 'JSON',
default => sub {
JSON->new->utf8->
is_success) {
my $json;
my $result;
eval { $json = $self->json->decode($res->content) };
unless ($@) {
foreach my $queue (@{$json}){
my $na
sages},
});
}
}
return {error => 'Could not parse JSON'} unless $result;
return $result;
}
else {
return { error => $res->status
rom_stream";
my %types = (
storable => "KiokuDB::Serializer::Storable",
json => "KiokuDB::Serializer::JSON",
yaml => "KiokuDB::Serializer::YAML",
);
coerce( __PACKAGE__,
from
eserialize);
my %types = (
storable => "KiokuDB::Serializer::Storable",
json => "KiokuDB::Serializer::JSON",
yaml => "KiokuDB::Serializer::YAML",
memory => "KiokuDB::Seriali
nd::Serialize::Storable>,
L<KiokuDB::Backend::Serialize::YAML> and L<KiokuDB::Backend::Serialize::JSON>
for examples.
=head1 REQUIRED METHODS
=over 4
=item serializate $entry
Takes a L<KiokuDB::En
use Carp 'croak';
use Dancer ':syntax';
use Dancer::Plugin;
my $content_types = {
json => 'application/json',
yml => 'text/x-yaml',
xml => 'application/xml',
};
our $default_serialize
(
($conf && exists $conf->{serializers})
? $conf->{serializers}
: { 'json' => 'JSON',
'yml' => 'YAML',
'xml' => 'XML',
'dump' => 'Dumper',
format' => sub {
User->find(params->{id});
};
# curl http://mywebservice/user/42.json
{ "id": 42, "name": "John Foo", email: "john.foo@example.com"}
# curl http://mywebservic
ojolicious::Plugin::DirectoryQueue;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::JSON qw(decode_json encode_json);
use Directory::Queue;
use POSIX qw(chown);
our $VERSION = '0.01';
sub register
elper(
enqueue => sub {
my ($self, $args) = @_;
$dirq->add(encode_json($args));
},
);
$app->helper(
dequeue => sub {
for (my $name
my $data = $dirq->get($name);
$dirq->remove($name);
return decode_json($data) if $data;
}
return;
},
);
$app->helper(
s
azy => 1,
required => 1,
default => 'https://api.hipchat.com/v1/rooms/message?format=json&auth_token=',
);
has 'hc_err' => (
is => 'rw',
isa => 'HashRef',
requir