package JSON::Schema::AsType::Draft6;
our $AUTHORITY = 'cpan:YANICK';
# ABSTRACT: Role processing draft6 JSON Schema
$JSON::Schema::AsType::Draft6::VERSION = '0.4.4';
use strict;
use warnings;
use
Str ArrayRef Int slurpy Dict Optional slurpy /;
use JSON;
use JSON::Schema::AsType;
use JSON::Schema::AsType::Draft6::Types '-all';
with 'JSON::Schema::AsType::Draft4';
override all_keywords =>
my $self = shift;
return super() if ref $self->schema eq 'HASH';
use JSON;
return( ( $self->schema eq JSON::true) ? Any : ~Any );
};
sub _keyword_const {
my $self = shift;
package JSON::Schema::AsType::Draft3;
our $AUTHORITY = 'cpan:YANICK';
# ABSTRACT: Role processing draft3 JSON Schema
$JSON::Schema::AsType::Draft3::VERSION = '0.4.4';
use strict;
use warnings;
use
ils qw/ any all none uniq zip /;
use JSON::Schema::AsType;
use JSON;
use JSON::Schema::AsType::Draft3::Types '-all';
use Types::Standard 'Optional';
with 'JSON::Schema::AsType::Draft4' => {
-e
dencies
];
}
JSON::Schema::AsType->new(
draft_version => '3',
uri => "http${_}://json-schema.org/draft-03/schema",
schema => from_json <<'END_JSON' )->type for '', '
package JSON::Schema::AsType;
our $AUTHORITY = 'cpan:YANICK';
# ABSTRACT: generates Type::Tiny types out of JSON schemas
$JSON::Schema::AsType::VERSION = '0.4.4';
use 5.14.0;
use strict;
use warnings
:Utils;
use LWP::Simple;
use Clone 'clone';
use URI;
use Moose::Util qw/ apply_all_roles /;
use JSON;
use Moose;
use MooseX::MungeHas 'is_ro';
use MooseX::ClassAttribute;
no warnings 'uninitializ
c => (
is => 'ro',
lazy => 1,
default => sub {
$_[0]->fetch( sprintf "https://json-schema.org/draft-%02d/schema", $_[0]->draft_version );
},
);
has schema => (
predicate
package JSON::Schema::AsType::Draft4;
our $AUTHORITY = 'cpan:YANICK';
# ABSTRACT: Role processing draft4 JSON Schema
$JSON::Schema::AsType::Draft4::VERSION = '0.4.4';
use strict;
use warnings;
use
Of HashRef StrictNum Any Str ArrayRef Int slurpy Dict Optional slurpy /;
use JSON;
use JSON::Schema::AsType;
use JSON::Schema::AsType::Draft4::Types '-all';
override all_keywords => sub {
my
my $schema = $self->resolve_reference($ref);
join "\n", "ref schema is " . to_json($schema->schema, { allow_nonref => 1 }), @{$schema->validate_explain($_)}
}
SLIF::JSON::Decoder;
use parent qw/MarpaX::ESLIF::Grammar/;
use MarpaX::ESLIF::JSON::Decoder::RecognizerInterface;
#
# Base required class methods
#
sub _ALLOCATE { return \&MarpaX::ESLIF::JSON::Deco
($definedStrict && $_definedStrict && ($strict == $args_ref->[1]))
}
}
# ABSTRACT: ESLIF's JSON decoder interface
our $AUTHORITY = 'cpan:JDDPAUSE'; # AUTHORITY
our $VERSION = '6.0.35.1'; # VE
ub decode {
my ($self, $string, %options) = @_;
my $recognizerInterface = MarpaX::ESLIF::JSON::Decoder::RecognizerInterface->new($string, $options{encoding});
return $self->_decode($recog
006; use strict; use warnings;
package JSON::ToHTML;
our $VERSION = '0.001';
use Scalar::Util ();
sub json_object_to_html;
sub json_array_to_html;
sub json_values_to_html {
my $copy;
map +(
(
? '<i>null</i>'
: 'HASH' eq ref $_ ? json_object_to_html $_
: 'ARRAY' eq ref $_ ? json_array_to_html $_
: eval { $$_ eq 1 or $$_ eq 0 } ? ( $$_ ?
/div>'
: grep s!([<>"'&@\x{80}-\x{10FFFF}])!'&#'.(ord $1).';'!ge || 1, $copy = $_
), @_
}
sub json_identical_keys {
return if grep 'HASH' ne ref, @_;
my $keyset = join ':', map length . $_, my @
package MARC::Moose::Parser::Json;
# ABSTRACT: Parser for JSON records
$MARC::Moose::Parser::Json::VERSION = '1.0.49';
use Moose;
extends 'MARC::Moose::Parser';
use JSON;
override 'parse' => sub {
my ($self, $raw) = @_;
return unless $raw;
my $json = from_json($raw);
my @jfields = @{$json->{fields}};
my @fields;
while ( @jfields ) {
my $tag = shift @jfields;
value => $value );
}
}
my $record = MARC::Moose::Record->new(
leader => $json->{leader},
fields => \@fields );
$record->lint($self->lint) if $record->lint;
ret
package MARC::Moose::Formater::Json;
# ABSTRACT: Record formater into a Json representation
$MARC::Moose::Formater::Json::VERSION = '1.0.49';
use Moose;
extends 'MARC::Moose::Formater';
use MARC::Mo
ose::Field::Control;
use MARC::Moose::Field::Std;
use JSON;
has pretty => ( is => 'rw', isa => 'Bool', default => 0 );
override 'format' => sub {
my ($self, $record) = @_;
my $rec = {
o_json($rec, { pretty => $self->pretty } ) . ",\n";
};
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
MARC::Moose::Formater::Json - Record formater into a Json r
mandu::Serializer::json_string;
use Catmandu::Sane;
use JSON qw();
use Moo;
has json => (
is => "ro",
lazy => 1,
init_arg => undef,
default => sub {JSON->new()->utf8(0);}
ze {
$_[0]->json()->encode($_[1]);
}
sub deserialize {
$_[0]->json()->decode($_[1]);
}
1;
__END__
=pod
=head1 NAME
Catmandu::Serializer - A (de)serializer from and to json strings
=head
1 DESCRIPTION
serializer 'json' returns a binary utf-8 string,
which only makes sense if you send your data to column of type 'binary'
use this serializer if your data column is a text
:JSON::Enhanced;
use 5.010;
use strict;
use warnings;
our $VERSION = '0.10';
use strict;
use warnings;
# which loads JSON::XS with a purel-perl JSON fallback
use JSON;
use Data::Roundtrip qw/json
() don't import it
our @ISA = qw(Exporter);
our @EXPORT = qw/
config2perl
/;
# Convert enhanced JSON string into a Perl data structure.
# The input parameters hashref:
# * specify where is the cont
ute
# <% xx %> with hello
# * optional 'remove-comments-in-strings' to remove comments from JSON strings
# (both keys and values), default is to KEEP anything inside a string
# even if it
package Data::Printer::Profile::JSON;
use strict;
use warnings;
sub profile {
return {
show_tainted => 0,
show_unicode => 0,
show_lvalue => 0,
print_escapes => 0,
'-class' => \&_json_class_filter,
'SCALAR' => \&_json_scalar_filter,
'LVALUE' => \&_json_scalar_filter,
'CODE' => \&_json_code_filter,
'FORMAT' => \&_json_format_filter,
'GLOB' => \&_json_glob_filter,
'REF' => \&_json_ref_filter,,
'Regexp' => \&_json_regexp_filter,
package Search::Elasticsearch::Role::Serializer::JSON;
$Search::Elasticsearch::Role::Serializer::JSON::VERSION = '8.12';
use Moo::Role;
requires 'JSON';
use Search::Elasticsearch::Util qw(throw);
us
de_utf8 is_utf8);
use namespace::clean;
has 'mime_type' => ( is => 'ro', default => 'application/json' );
with 'Search::Elasticsearch::Role::Serializer';
#===================================
sub en
n is_utf8($var)
? encode_utf8($var)
: $var;
}
return try { $self->JSON->encode($var) }
catch { throw( "Serializer", $_, { var => $var } ) };
}
#===================
package Log::Log4perl::Layout::JSON;
$Log::Log4perl::Layout::JSON::VERSION = '0.61';
# ABSTRACT: Layout a log message as a JSON hash, including MDC data
use 5.010;
use strict;
use warnings;
use pare
nt qw(Log::Log4perl::Layout);
use Carp;
use JSON::MaybeXS;
use Log::Log4perl ();
use Log::Log4perl::Layout::PatternLayout;
use Log::Log4perl::Level;
use Scalar::Util qw(blessed);
# TODO
# add eval
use Class::Tiny {
prefix => "",
format_prefix => 0,
codec => sub {
return JSON::MaybeXS->new
->indent(0) # to prevent newlines (and save space)
} else {
my $uri = URI->new( $args->{file} );
my @ext = qw( .html .htm .json .jsn .yaml .yml .gif .png .jpg .jpeg .csv .xls .xlsx .sxc .ods );
my (undef,undef,$su
TML::_parse( $args );
} elsif ($file =~ /\.jso?n$/) {
return Spreadsheet::HTML::File::JSON::_parse( $args );
} elsif ($file =~ /\.ya?ml$/) {
return Spreadsheet::HTML::File::YAM
.htm' )
generate( file => 'foo.html' )
=item * JSON
Parses with (requires) L<JSON>.
generate( file => 'foo.jsn' )
generate( file => 'foo.json' )
=item * YAML
Parses with (requires) L<YAML>.
icsearch::Serializer::JSON;
$Search::Elasticsearch::Serializer::JSON::VERSION = '8.12';
use Moo;
use JSON::MaybeXS 1.002002 ();
has 'JSON' => ( is => 'ro', default => sub { JSON::MaybeXS->new->utf8(1
:JSON';
use namespace::clean;
1;
# ABSTRACT: The default JSON Serializer, using JSON::MaybeXS
__END__
=pod
=encoding UTF-8
=head1 NAME
Search::Elasticsearch::Serializer::JSON - The default JSON
Serializer, using JSON::MaybeXS
=head1 VERSION
version 8.12
=head1 SYNOPSIS
$e = Search::Elasticsearch(
# serializer => 'JSON'
);
=head1 DESCRIPTION
This default Serializer clas
sticsearch::Serializer::JSON::XS;
$Search::Elasticsearch::Serializer::JSON::XS::VERSION = '8.12';
use Moo;
use JSON::XS 2.26;
has 'JSON' => ( is => 'ro', default => sub { JSON::XS->new->utf8(1) } );
arch::Elasticsearch::Role::Serializer::JSON';
1;
=pod
=encoding UTF-8
=head1 NAME
Search::Elasticsearch::Serializer::JSON::XS - A JSON Serializer using JSON::XS
=head1 VERSION
version 8.12
=he
h(
serializer => 'JSON::XS'
);
=head1 DESCRIPTION
While the default serializer, L<Search::Elasticsearch::Serializer::JSON>,
tries to choose the appropriate JSON backend, this module allo
Elasticsearch::Serializer::JSON::PP;
$Search::Elasticsearch::Serializer::JSON::PP::VERSION = '8.12';
use Moo;
use JSON::PP;
has 'JSON' => ( is => 'ro', default => sub { JSON::PP->new->utf8(1) } );
w
Serializer::JSON';
1;
# ABSTRACT: A JSON Serializer using JSON::PP
__END__
=pod
=encoding UTF-8
=head1 NAME
Search::Elasticsearch::Serializer::JSON::PP - A JSON Serializer using JSON::PP
=head
h(
serializer => 'JSON::PP'
);
=head1 DESCRIPTION
While the default serializer, L<Search::Elasticsearch::Serializer::JSON>,
tries to choose the appropriate JSON backend, this module allo
:Serializer::JSON::Cpanel;
$Search::Elasticsearch::Serializer::JSON::Cpanel::VERSION = '8.12';
use Cpanel::JSON::XS;
use Moo;
has 'JSON' =>
( is => 'ro', default => sub { Cpanel::JSON::XS->new->u
Elasticsearch::Role::Serializer::JSON';
1;
=pod
=encoding UTF-8
=head1 NAME
Search::Elasticsearch::Serializer::JSON::Cpanel - A JSON Serializer using Cpanel::JSON::XS
=head1 VERSION
version 8.1
serializer => 'JSON::Cpanel'
);
=head1 DESCRIPTION
While the default serializer, L<Search::Elasticsearch::Serializer::JSON>,
tries to choose the appropriate JSON backend, this module al
package Aion::Format::Json;
use common::sense;
use JSON::XS qw//;
use Exporter qw/import/;
our @EXPORT = our @EXPORT_OK = grep {
*{$Aion::Format::Json::{$_}}{CODE} && !/^(_|(NaN|import)\z)/n
} k
ory json
# Настраиваем json
our $JSON = JSON::XS->new->allow_nonref->indent(1)->space_after(1)->canonical(1);
# В json
sub to_json(;$) {
$JSON->encode(@_ == 0? $_: @_)
}
# Из json
su
_json(;$) {
$JSON->decode(@_ == 0? $_: @_)
}
1;
__END__
=encoding utf-8
=head1 NAME
Aion::Format::Json - Perl extension for formatting JSON
=head1 SYNOPSIS
use Aion::Format::Json;
to_json
package PayProp::API::Public::Client::Role::JSON;
use strict;
use warnings;
use Mouse::Role;
sub TO_JSON {
my ( $self, $value, $structure ) = @_;
$value //= $self unless $structure;
$structure
@items, $self->TO_JSON( $item, $structure );
}
return \@items;
}
elsif ( $ref_type eq 'HASH' ) {
foreach my $key ( keys $value->%* ) {
$structure->{ $key } = $self->TO_JSON( $value->{ $key
my $item = $value->$reader;
$structure->{ $key } //= {};
$structure->{ $key } = $self->TO_JSON( $item, $structure->{ $key } );
}
}
else {
die "Unhandled ref_type: $ref_type";
}
return