package JSON::Validator::Schema::OpenAPIv2;
use Mojo::Base 'JSON::Validator::Schema::Draft4';
use JSON::Validator::Util qw(E data_type negotiate_content_type schema_type);
use Mojo::Collection;
my $
->data)];
};
has moniker => 'openapiv2';
has specification => 'http://swagger.io/v2/schema.json';
sub add_default_response {
my ($self, $params) = ($_[0], shift->_params_for_add_default_resp
> sub {undef},
'byte' => JSON::Validator::Formats->can('check_byte'),
'date' => JSON::Validator::Formats->can('check_date'),
'date-time' => JSON::Validator::Formats->can('check_d
JSON::Validator::Schema;
use Mojo::Base 'JSON::Validator'; # TODO: Change this to "use Mojo::Base -base"
use Carp qw(carp);
use JSON::Validator::Formats;
use JSON::Validator::URI qw(uri);
use JSON
type prefix_errors schema_type str2data);
use List::Util qw(first uniq);
use Mojo::JSON qw(false true);
use Mojo::JSON::Pointer;
use Mojo::Util qw(deprecated);
use Scalar::Util qw(blessed);
has error
s => sub {
my $self = shift;
my $specification = $self->specification || 'http://json-schema.org/draft-04/schema#';
my $validator = $self->new(store => $self->store, _refs => {})->coerc
package JSON::Validator::Schema::Draft7;
use Mojo::Base 'JSON::Validator::Schema';
use JSON::Validator::Schema::Draft4;
use JSON::Validator::Schema::Draft6;
use JSON::Validator::Util qw(E is_type);
=> 'http://json-schema.org/draft-07/schema#';
sub _build_formats {
return {
'date' => JSON::Validator::Formats->can('check_date'),
'date-time' => JSON::Validato
=> JSON::Validator::Formats->can('check_email'),
'hostname' => JSON::Validator::Formats->can('check_hostname'),
'idn-email' => JSON::Validator::Format
ge JSON::Ordered::Conditional;
use 5.006; use strict; use warnings; our $VERSION = '0.03';
use JSON::MultiValueOrdered; use base 'Struct::Conditional';
use Tie::IxHash;
our $JSON;
BEGIN {
$JSON =
N::MultiValueOrdered->new;
}
sub encode {
if ($_[2]) {
$_[0]->encode_file($_[1], $_[2]);
}
$JSON->encode($_[1]);
}
sub encode_file {
open my $file, '>', $_[2] or die "cannot open file $!";
pr
ile;
}
sub decode {
if ( $_[1] !~ m/\n/ && -f $_[1]) {
return $_[0]->decode_file($_[1]);
}
$JSON->decode($_[1]);
}
sub decode_file {
open my $file, '<', $_[1] or die "cannot open file $!";
my
package JSON::Conditional;
use 5.006; use strict; use warnings; our $VERSION = '1.02';
use JSON; use base 'Struct::Conditional';
our $JSON;
BEGIN {
$JSON = JSON->new->pretty(1)->allow_blessed->conv
ert_blessed;
}
sub encode {
if ($_[2]) {
$_[0]->encode_file($_[1], $_[2]);
}
$JSON->encode($_[1]);
}
sub encode_file {
open my $file, '>', $_[2] or die "cannot open file $!";
print $file $_[0
le;
}
sub decode {
if ( $_[1] !~ m/\n/ && -f $_[1]) {
return $_[0]->decode_file($_[1]);
}
$JSON->decode($_[1]);
}
sub decode_file {
open my $file, '<', $_[1] or die "cannot open file $!";
my
package SReview::Files::Collection::HTTP::nginx::JSON;
use Moose;
use Mojo::UserAgent;
use DateTime::Format::Strptime;
extends 'SReview::Files::Collection::HTTP';
sub _probe_children {
my $self =
s->is_success) {
foreach my $obj(@{$res->json}) {
if($obj->{type} eq "directory") {
foreach my $child(@{SReview::Files::Collection::HTTP::nginx::JSON->new(baseurl => join("/", $self->baseurl,
tBodyParser::JSON;
use warnings;
use strict;
use CatalystX::RequestModel::Utils::InvalidJSON;
use base 'CatalystX::RequestModel::ContentBodyParser';
sub content_type { 'application/json' }
sub def
>_parse_json_body;
return $self;
}
sub _parse_json_body {
my ($self) = @_;
my $json = eval {
$self->{ctx}->req->body_data;
} || do {
CatalystX::RequestModel::Utils::InvalidJSON->throw
g_error=>$@);
};
return $json;
}
1;
=head1 NAME
CatalystX::RequestModel::ContentBodyParser::JSON
=head1 SYNOPSIS
TBD
=head1 DESCRIPTION
Given a valid JSON request body, parse it and in
use strict;
use warnings;
package YAML::PP::Schema::JSON;
our $VERSION = 'v0.39.0'; # VERSION
use base 'Exporter';
our @EXPORT_OK = qw/
represent_int represent_float represent_literal represent_
l') {
$empty_null = 1;
}
else {
croak "Invalid option for JSON Schema: '$opt'";
}
}
$schema->add_resolver(
tag => 'tag:yaml.org,2002:nu
ead1 NAME
YAML::PP::Schema::JSON - YAML 1.2 JSON Schema
=head1 SYNOPSIS
my $yp = YAML::PP->new( schema => ['JSON'] );
my $yp = YAML::PP->new( schema => [qw/ JSON empty=str /] );
my $yp
ckage SPVM::JSON;
our $VERSION = "1.002";
1;
=head1 NAME
SPVM::JSON - JSON
=head1 Description
JSON class in L<SPVM> has methods to manipulate L<JSON|https://en.wikipedia.org/wiki/JSON>.
=head1
Usage
use JSON;
# new
my $json = JSON->new;
# decode
my $spvm_data = $json->decode($json_data);
# encode
my $json_data = $json->encode($spvm_data);
=head1 Class Methods
=head
d new : JSON ();
Creates a new L<JSON|SPVM::JSON> object.
=head1 Instance Methods
=head2 encode
method encode : string ($spvm_data : object);
Converts the SPVM data $spvm_data to a JSON data.
package Sq::Data::JSON;
use 5.036;
# Basic easy way to encode/decode JSON data
1;
ls::JSON;
use strict;
use warnings;
our $VERSION = "0.06";
use Carp ();
use JSON::MaybeXS qw/JSON/;
use Test2::Compare::JSON();
%Carp::Internal = (
%Carp::Internal,
'Test2::Tools::JSON'
> 1,
'Test2::Compare::JSON' => 1,
);
our @EXPORT = qw/json relaxed_json/;
use Exporter 'import';
sub json ($) {
my @caller = caller;
return Test2::Compare::JSON->new(
file => $c
aller[2]],
inref => $_[0],
json => JSON->new->utf8,
);
}
sub relaxed_json ($) {
my @caller = caller;
return Test2::Compare::JSON->new(
file => $caller[1],
package Test2::Compare::JSON;
use strict;
use warnings;
use base 'Test2::Compare::Base';
use Carp qw/croak/;
use Test2::Util::HashBase qw/inref json/;
sub init {
my $self = shift;
croak "
f' must be a reference" unless ref $self->{+INREF};
$self->SUPER::init();
}
sub operator { 'JSON' }
sub name { '' . $_[0]->{+INREF} }
sub verify {
my $self = shift;
my %params = @_;
t, $exists) = @params{qw/got exists/};
return 0 unless $exists;
eval {
$self->{+JSON}->decode($got);
};
return $@ ? 0 : 1;
}
sub deltas {
my $self = shift;
my %para
;
package Data::Section::Pluggable::Plugin::Json 0.08 {
# ABSTRACT: Data::Section::Pluggable Plugin for JSON
use Role::Tiny::With;
use JSON::MaybeXS ();
with 'Data::Section::Plugg
return ('json');
}
sub process_content ($class, $dsp, $content) {
JSON::MaybeXS::decode_json($content);
}
sub format_content ($class, $dsw, $content) {
JSON::MaybeXS
END__
=pod
=encoding UTF-8
=head1 NAME
Data::Section::Pluggable::Plugin::Json - Data::Section::Pluggable Plugin for JSON
=head1 VERSION
version 0.08
=head1 SYNOPSIS
use Data::Section::Pluggab
use v5.14;
use warnings;
package Neo4j::Driver::Result::JSON 1.02;
# ABSTRACT: JSON/REST result handler
# This package is not part of the public Neo4j::Driver API.
use parent 'Neo4j::Driver::Resu
use Carp qw(croak);
our @CARP_NOT = qw(Neo4j::Driver::Net::HTTP);
use Feature::Compat::Try;
use JSON::MaybeXS 1.002004 ();
use Neo4j::Driver::Type::Bytes;
use Neo4j::Driver::Type::DateTime;
use Neo
n/json";
my $ACCEPT_HEADER = "$MEDIA_TYPE";
my $ACCEPT_HEADER_POST = "$MEDIA_TYPE;q=0.5";
sub new {
# uncoverable pod (private method)
my ($class, $params) = @_;
my $json = $class->_parse_json(
package Feed::Data::Parser::JSON;
use Moo;
extends 'Feed::Data::Parser::Base';
use Compiled::Params::OO qw/cpo/;
use Types::Standard qw/Object HashRef Str/;
use JSON;
our $validate;
BEGIN {
$valida
r' => (
default => sub {
my $self = shift;
my $content = $self->content_ref;
my $matches = JSON->new->decode($$content);
return { items => $matches };
},
);
has '+potential_fields' => (
de
able qw( postderef );
use true;
package JSON::LD 0.02 {
# ABSTRACT: Load and dump JSON files
use Exporter qw( import );
use Path::Tiny ();
use JSON::MaybeXS ();
our @EXPORT = qw( LoadFi
{
return JSON::MaybeXS::decode_json(Path::Tiny->new($filename)->slurp_raw);
}
sub DumpFile ($filename, $data) {
Path::Tiny->new($filename)->spew_raw(JSON::MaybeXS::encode_json($data));
F-8
=head1 NAME
JSON::LD - Load and dump JSON files
=head1 VERSION
version 0.02
=head1 SYNOPSIS
use JSON::LD;
DumpFile("foo.json", { a => 1 });
my $data - LoadFile("foo.json:");
=head1 DESC
ucer::JSON;
=head1 NAME
SQL::Translator::Producer::JSON - A JSON producer for SQL::Translator
=head1 SYNOPSIS
use SQL::Translator;
my $translator = SQL::Translator->new(producer => 'JSON');
a JSON string.
=cut
use strict;
use warnings;
our $VERSION = '1.66';
use JSON::MaybeXS 'to_json';
sub produce {
my $translator = shift;
my $schema = $translator->schema;
return to_json(
? ('extra' => { $index->extra }) : (),
};
}
1;
=head1 SEE ALSO
SQL::Translator, JSON::MaybeXS, http://www.json.org/.
=head1 AUTHORS
darren chamberlain E<lt>darren@cpan.orgE<gt>,
Ken Youens-Clar
r::Parser::JSON;
use strict;
use warnings;
our $VERSION = '1.66';
use SQL::Translator::Schema;
use SQL::Translator::Utils qw(header_comment);
use Data::Dumper;
use JSON::MaybeXS 'from_json';
sub pa
rse {
my ($translator, $data) = @_;
$data = from_json($data);
$data = $data->{'schema'};
warn "JSON data:", Dumper($data) if $translator->debug;
my $schema = $translator->schema;
#
#
SQL::Translator::Parser::JSON - Parse a JSON representation of a schema
=head1 SYNOPSIS
use SQL::Translator;
my $translator = SQL::Translator->new(parser => "JSON");
=head1 DESCRIPTION
C
package UserAgent::Any::JSON;
use 5.036;
use Carp;
use Moo;
use UserAgent::Any::JSON::Response;
use UserAgent::Any::Wrapper 'wrap_get_like_methods', 'wrap_post_like_methods';
use namespace::clean;
= 0.05;
extends 'UserAgent::Any';
has _converter => (
init_arg => 'json',
is => 'ro',
default => sub { require JSON; JSON->new },
);
# This is not specific to GET and can actually handle any
on/json',
'Content-Type' => 'application/json',
@args,
defined $body ? ($self->_converter->encode($body)) : ());
}
sub _process_response ($self, $res, @) {
return UserAgent::Any::JSON::
package UserAgent::Any::JSON::Response;
use 5.036;
use Carp;
use Moo;
use Scalar::Util 'blessed';
use namespace::clean;
our $VERSION = 0.03;
extends 'UserAgent::Any::Response';
has _converter =>
=> sub { require JSON; JSON->new },
);
has json => (
is => 'ro',
lazy => 1,
# TODO: here we should maybe check the Content-Type header of the response
# (for application/json) before proceedi
1 NAME
UserAgent::Any::JSON::Response – Response object for L<UserAgent::Any::JSON>
=head1 SYNOPSIS
my $response = $json_client->get($url);
print Dumper($response->json) if $response->success