quire Carp;
$SIG{ __DIE__ } = \&Carp::confess;
$SIG{ __WARN__ } = \&Carp::cluck;
};
use JSON ();
use Getopt::Long 'GetOptions';
use Salvation::TC ();
use Salvation::MongoMgr ();
use Salvati
s );
my $json = JSON -> new() -> utf8( 1 ) -> allow_blessed( 1 );
if( $opts -> { 'pretty' } ) {
$json = $json -> pretty();
}
print( $json -> encode( $rv
is is a graylog logging radio through a redis database
use Moo 2;
use Redis 1.980;
use JSON 2.90 qw(encode_json);
use Time::HiRes 1.9726;
use Sys::Hostname ;
use Carp qw(croak carp);
use Scalar::Util
lf{timestamp} //= Time::HiRes::time();
# graylog seems to have problems with float values in json
# so force string, which works fine
$gelf{timestamp} = ''.$gelf{timestamp};
$gelf{sh
}
sub push {
my ($self, $gelf) = @_;
if (ref $gelf eq 'HASH') {
$gelf = encode_json($gelf);
}
$self->redis->lpush($self->queue, $gelf);
}
1;
__END__
=pod
=head1 NAME
Lo
package Test::HTTP::MockServer::REST;
use strict;
use warnings;
use JSON::XS;
sub new {
my ($class) = shift;
$class = ref $class || $class;
my %dispatch = @_;
return bless { d => \%di
if ($input_content && $input_ct && $input_ct eq 'application/json') {
eval {
$input_data = decode_json $req->content;
};
if ($@) {
&& $a eq 'application/json') {
eval {
my $out = encode_json $return_data;
$res->header('Content-type', 'application/json');
purged of any keys that are no longer relevant.
It should be safe to save this structure using L<JSON> or L<YAML> or L<MongoDB> or L<Storable> or whatever you like and load it again, if you want the
ion;
use utf8;
use strict;
use warnings;
use boolean;
use feature 'state';
use URI ();
use JSON 'from_json';
use File::Slurp 'read_file';
use Salvation::TC ();
use MongoDB ();
sub new {
my (
if( defined( my $auth_config_file = $self -> auth_config_file() ) ) {
my $rv = from_json( scalar( read_file( $auth_config_file ) ) );
Salvation::TC -> assert( $rv, sprintf( 'Has
-> { 'servers_list' } = [ $self -> { 'host' } ];
} else {
my $config = from_json( scalar( read_file( $self -> config_file() ) ) );
Salvation::TC -> assert( $config,
allow_text_type => $self->{'allow_text_type'},
}
);
# create BigQuery schema json structure
my $schema_type_check_sql = "SELECT
CONCAT('{\"name\": \"', COLUMN_NAME, '\
TA_TYPE LIKE \"%int%\", \"INTEGER\",IF(DATA_TYPE = \"decimal\",\"FLOAT\",\"STRING\")) , '\"}') AS json
FROM INFORMATION_SCHEMA.columns where TABLE_SCHEMA = '${src_schema}' AND TABLE_NAME = '${
bq_schema_json = '[' . join(',', @schemas) . ']';
my($bq_schema_json_fh, $bq_schema_json_filename) = tempfile(UNLINK => 1);
unless ($self->{'dryrun'}) {
print {$bq_schema_json_fh} $bq_
rators::Address;
use strict;
use warnings;
use JMAP::Validation::Generators::String;
use JSON::PP;
use JSON::Typist;
sub generate {
my @Addresses;
foreach my $type (qw{home work billing postal
ring->generate(), undef) {
foreach my $isDefault (JSON::PP::true, JSON::PP::false) {
push @Addresses, {
type => JSON::Typist::String->new($type),
label => $l
N = '0.001';
use Method::Signatures;
use Test::Mountebank::Types qw( HTTPHeaders );
use JSON::Tiny qw(encode_json);
use File::Slurper qw/read_text/;
use Carp;
use MIME::Types;
has status_code => (
tures;
use Test::Mountebank::Predicate::Equals;
use Test::Mountebank::Response::Is;
use JSON::Tiny qw(encode_json);
use Carp;
has predicates => (
traits => ['Array'],
is => 'ro',
is
map_responses( sub { $_->as_hashref } ) ],
predicates => [ $self->map_predicates( sub { $_->as_hashref } ) ],
};
}
method as_json() {
return encode_json( $self->as_hashref() );
}
1;
Client;
use Moose;
our $VERSION = '0.001';
use Method::Signatures;
use HTTP::Tiny;
use JSON::Tiny qw(encode_json);
use Test::Mountebank::Imposter;
has ua => (
is => 'ro',
default => sub
) {
$self->ua->post(
$self->mb_url . "/imposters",
{
headers => { "Content-Type" => "application/json" },
content => $imp->as_json,
},
);
}
1;
ailable
403 GPIO # Disabled
404 [something] Not Found
=head2 BASIC
=head3 GET /map
Returns a JSON list, with each entry corresponding to a pin on the physical
header. Each entry can be:
=over
7, 18, 27, "GND", 22, 23, "V33", 24, 10, "GND", 9, 25, 11, 8, "GND", 7]
=head3 GET /*
Returns a JSON of available interfaces. Keys:
=over 4
=item * UART [bool]
=item * SPI [bool]
=item * I2C [b
::Generators::SetError;
use strict;
use warnings;
use JMAP::Validation::Generators::String;
use JSON::Typist;
my %types = (
invalidArguments => {
description => JMAP::Validation::Generators::
ors;
foreach my $type (@types ? @types : (keys %types)) {
push @SetErrors, {
type => JSON::Typist::String->new($type),
($types{$type} ? (%{$types{$type}}) : ()),
};
}
retur
Moose;
our $VERSION = '0.001';
use Method::Signatures;
use Test::Mountebank::Stub;
use JSON::Tiny qw(encode_json);
use Carp;
has protocol => ( is => 'rw', isa => 'Str', default => 'http' );
has port
[ $self->map_stubs( sub { $_->as_hashref } ) ],
protocol => $self->protocol,
port => $self->port,
};
}
method as_json() {
return encode_json( $self->as_hashref() );
}
1;
ountebank::Types qw( HTTPHeaders );
use MooseX::Types::HTTPMethod qw(HTTPMethod11);
use JSON::Tiny qw(encode_json);
has method => ( is => 'ro', isa => HTTPMethod11 );
has path => ( is =>
package Net::Google::CalendarV3::ToJson;
$Net::Google::CalendarV3::ToJson::VERSION = '0.16';
use Moose::Role;
use Kavorka;
method TO_JSON {
return { %$self };
};
1;
package Flickr::API2::Raw;
use 5.12.0;
use warnings;
use JSON qw(decode_json);
use Digest::MD5 qw(md5_hex);
use Compress::Zlib;
use LWP::UserAgent;
use Retry;
use Encode;
use Carp qw(croak);
use paren
json = eval { decode_json($content) };
if ($@) {
croak("Failed to parse API response as JSON. Error=$@\nContent=$content\n");
}
if ( $json->{stat} eq 'ok' ) {
return $json
tage, I think.
}
croak(sprintf("API call failed: \%s (\%s)\n",
$json->{message}, $json->{code})
);
}
=head2 do_request
Calls LWP::UserAgent's ->request method, but does
Exporter 'import';
@EXPORT = qw/profile trophies/;
use strict;
use warnings;
use HTTP::Tiny;
use JSON;
use constant ORIGIN => 'https://www.playstation.com';
use constant IO
url<. :(\n" unless $response->{success};
my $json_data = $response->{content};
$json_data =~ s/^\s+|\s+$//g;
return JSON::decode_json($json_data);
}
1;
=pod
=encoding UTF-8
=head1 NAME
Event );
use Net::Google::CalendarV3::Calendar;
use Net::Google::CalendarV3::Event;
use WWW::JSON;
use JSON::XS;
has authentication => is => 'ro', lazy => 1, predicate => 'has_auth', builder => '_bui
=> 1;
method _build_service {
WWW::JSON->new( base_url => 'https://www.googleapis.com/calendar/v3',
post_body_format => 'JSON',
( $self->has_auth
lf->has_token ? (authentication => $self->authentication) : () ),
json => JSON::XS->new->utf8->allow_nonref->allow_blessed->convert_blessed,
);
}
method _build_a
atalyst::TraitFor::Model::DBIC::Schema::QueryLog::AdoptPlack>.
use Plack::Builder;
use JSON;
use Plack::Debugger;
use Plack::Debugger::Storage;
use Plack::App::Debugger;
l',
serializer => sub { encode_json( shift ) },
deserializer => sub { decode_json( shift ) },
filename_fmt => "%s.json",
),
panels => [
ame database ssl json)],
);
use Carp;
use Data::Validator;
use Mouse::Util::TypeConstraints;
use Furl;
use URI::Escape;
use JSON 2;
enum 'TimePrecision' => qw(s m u);
subtype 'JSONBool' => as 'Scal
rRef';
coerce 'JSONBool'
=> from 'Bool' => via { $_ ? \1 : \0 }
=> from 'Object' => via { JSON::is_bool($_) ? ($_ == 1 ? \1 : \0) : \0 }
;
sub new {
state $rule = Data::Validator->new(
oin('/', __PACKAGE__, $VERSION),
timeout => $args->{timeout},
),
json => JSON->new,
status => {},
%$args
}, $class;
return $self;
}
sub debugf {