package JSON::RPC2::AnyEvent::Constants;
use 5.010;
use strict;
use warnings;
my %constants;
BEGIN{
# Based upon JSON-RPC spec 2.0 - http://www.jsonrpc.org/specification
%constants = (
valid JSON was received by the server.
# An error occurred on the server while parsing the JSON text.
ERR_INVALID_REQUEST => -32600, # The JSON sent
=> -32602, # Invalid method parameter(s).
ERR_INTERNAL_ERROR => -32603, # Internal JSON-RPC error.
ERR_SERVER_ERROR => -32000, # -32000 to -32099: Reserved for implementati
package JSON::RPC2::AnyEvent::Server;
use 5.010;
use strict;
use warnings;
our $VERSION = "0.03";
use AnyEvent;
use Carp 'croak';
use Scalar::Util 'reftype';
use Try::Tiny;
use JSON::RPC2::AnyEvent
lf = shift;
my $json = shift;
my $ret_cv = AE::cv;
try{
my $type = _check_format($json); # die when $json's format is invalid
my $method = $self->{$json->{method}};
unless ( $method ) { # Method not found
$ret_cv->send(_make_error_response($json->{id}, ERR_METHOD_NOT_FOUND, 'Method not found'));
return $ret_cv;
}
if ( $t
package JSON::RPC2::AnyEvent;
our $VERSION = "0.03";
use JSON::RPC2::AnyEvent::Server;
1;
__END__
=encoding utf-8
=head1 NAME
JSON::RPC2::AnyEvent - Yet-another, transport-independent and asynch
ronous JSON-RPC 2.0 implementation
=head1 SYNOPSIS
use JSON::RPC2::AnyEvent::Server;
my $srv = JSON::RPC2::AnyEvent::Server->new(
hello => "[family_name, first_name]" => sub{
= $srv->dispatch({
jsonrpc => "2.0",
id => 1,
method => 'hello',
params => [qw(Sogoru Kyo)],
});
my $res = $cv->recv; # { jsonrpc => "2.0", id => 1, res
rnings;
package Dancer2::Session::JSON;
# ABSTRACT: Dancer 2 session storage in files with JSON
our $VERSION = '0.003';
use Moo;
use Dancer2::Core::Types;
use JSON;
#------------------------------
=> 'ro',
isa => Str,
default => sub { ".json" },
);
has _encoder => (
is => 'lazy',
isa => InstanceOf ['JSON'],
handles => {
'_freeze' => 'encode',
'_thaw' => 'decode'
},
);
sub _build__encoder {
my ($self) = @_;
return JSON->new->allow_blessed->convert_blessed;
}
#---------------------------------------------------------------
package Test::Mojo::Role::Debug::JSON;
$Test::Mojo::Role::Debug::JSON::VERSION = '0.005';
# ABSTRACT: a JSON extension to Test::Mojo::Role::Debug
use Mojo::Base -role;
with 'Test::Mojo::Role::Debug'
::JSON qw{from_json};
use Mojo::JSON::Pointer;
use Test::More ();
# VERSION
sub djson {
my ( $self, $pointer ) = @_;
return $self->success ? $self : $self->djsona( $pointer );
}
sub djsona
local $@;
my $json = eval { from_json( $self->tx->res->content->asset->slurp ) };
Test::More::diag( $@ ) && return $self if $@;
Test::More::diag( "DEBUG JSON DUMPER:\n",
Test:
package Ark::View::JSON;
use strict;
use warnings;
use Ark 'View';
use JSON;
has allow_callback => (
is => 'rw',
isa => 'Bool',
default => 0,
);
has callback_param => (
is
;
has json_driver => (
is => 'rw',
isa => 'Object',
lazy => 1,
default => sub {
my $self = shift;
JSON->new->utf8->allow_nonref;
},
);
has json_dumper
'CodeRef',
lazy => 1,
default => sub {
my $self = shift;
sub { $self->json_driver->encode(@_) };
},
);
has status_code_field => (
is => 'ro',
isa => "Str",
);
package Log::ger::Layout::JSON;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2020-03-07'; # DATE
our $DIST = 'Log-ger-Layout-JSON'; # DIST
our $VERSION = '0.002'; # VERSION
use 5.0100
ub _encode {
my ($pkg, $msg) = @_;
state $json = do {
require JSON::MaybeXS;
JSON::MaybeXS->new->canonical;
};
$json->encode($msg);
}
sub get_hooks {
__PACKAGE__-
1;
# ABSTRACT: Layout log message as a JSON object (hash)
__END__
=pod
=encoding UTF-8
=head1 NAME
Log::ger::Layout::JSON - Layout log message as a JSON object (hash)
=head1 VERSION
This docu
package Pegex::JSON::Data;
use Pegex::Base;
extends 'Pegex::Tree';
use boolean;
sub got_json { shift @{(pop)} }
sub got_object { +{map @$_, @{(pop)}} }
my %escapes = (
'"' => '"',
'/' => "
ing {
my $string = pop;
$string =~ s/\\(["\/\\bfnrt])/$escapes{$1}/ge;
# This handles JSON encoded Unicode surrogate pairs
$string =~ s/\\u([0-9a-f]{4})\\u([0-9a-f]{4})/pack "U*", hex(
ializer::JSON;
BEGIN { @Data::Serializer::JSON::ISA = qw(Data::Serializer) }
use warnings;
use strict;
use JSON;
use vars qw($VERSION @ISA);
$VERSION = '0.04';
sub serialize {
return JSON->VERSION
jToJson($_[1]) : JSON->new->utf8->encode($_[1]);
}
sub deserialize {
#return JSON->VERSION < 2 ? JSON->new->jsonToObj($_[1]) : JSON->new->decode($_[1]);
$_[1] and return JSON->VERSION < 2 ? JSON->n
ew->jsonToObj($_[1]) : JSON->new->utf8->decode($_[1]);
}
1;
__END__
=head1 NAME
Data::Serializer::JSON - Creates bridge between Data::Serializer and JSON
=head1 SYNOPSIS
use Data::Serializer:
x::JSON::Grammar;
use Pegex::Base;
extends 'Pegex::Grammar';
use constant file => '../json-pgx/json.pgx';
sub make_tree { # Generated/Inlined by Pegex::Grammar (0.73)
{
'+grammar' => 'json',
'+include' => 'pegex-atoms',
'+toprule' => 'json',
'+version' => '0.0.1',
'_' => {
'.rgx' => qr/\G\s*/
},
'array' => {
'.all' => [
{
'-skip' => 1
qr/\G\s*\]\s*/
}
]
},
'false' => {
'.rgx' => qr/\Gfalse/
},
'json' => {
'.all' => [
{
'.ref' => '_'
},
{
'.ref' =
ackage Pegex::JSON;
BEGIN { $ENV{PERL_PEGEX_AUTO_COMPILE} = 'Pegex::JSON::Grammar' }
our $VERSION = '0.31';
use Pegex::Base;
use Pegex::Parser;
use Pegex::JSON::Grammar;
use Pegex::JSON::Data;
sub
load {
my ($self, $json) = @_;
Pegex::Parser->new(
grammar => Pegex::JSON::Grammar->new,
receiver => Pegex::JSON::Data->new,
# debug => 1,
)->parse($json);
}
1;
package Data::Serializer::JSON::Syck;
BEGIN { @Data::Serializer::JSON::Syck::ISA = qw(Data::Serializer) }
use warnings;
use strict;
use JSON::Syck;
use vars qw($VERSION @ISA);
$VERSION = '0.02';
su
return JSON::Syck::Load($_[1]);
}
1;
__END__
=head1 NAME
Data::Serializer::JSON::Syck - Creates bridge between Data::Serializer and JSON::Syck
=head1 SYNOPSIS
use Data::Serializer::JSON::Syck;
head1 COPYRIGHT
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
=head1 SEE ALSO
perl(1), Data::Serializer(3), JSON::Syck(3).
=cut
if $] < 5.010, 'UNIVERSAL::DOES';
{
package JSON::MultiValueOrdered;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.006';
use base qw(JSON::Tiny::Subclassable);
use Tie::Hash::Multi
__END__
=head1 NAME
JSON::MultiValueOrdered - handle JSON like {"a":1, "a":2}
=head1 SYNOPSIS
use Test::More tests => 4;
use JSON::MultiValueOrdered;
my $j = JSON::MultiValueOrdered->
isa_ok $j, 'JSON::Tiny';
my $data = $j->decode(<<'JSON');
{
"a": 1,
"b": 2,
"a": 3,
"b": 4
}
JSON
# As you'd expect, for repeated values, the last val
.008;
use strict;
use warnings;
{
package JSON::Tiny::Subclassable;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.006';
our @ISA = qw(JSON::Tiny);
use B;
use Encode ();
use Sca
mport('j');
# Literal names
my $FALSE = bless \(my $false = 0), 'JSON::Tiny::_Bool';
my $TRUE = bless \(my $true = 1), 'JSON::Tiny::_Bool';
# Escaped special character map (with u2028 and u2
= qr/[\x20\x09\x0a\x0d]*/;
sub DOES {
my ($proto, $role) = @_;
return 1 if $role eq 'Mojo::JSON';
return $proto->SUPER::DOES($role);
}
sub decode {
my ($self, $bytes) = @_;
# Clean
package JSON::Transform::Grammar;
use strict;
use warnings;
use base 'Pegex::Grammar';
use constant file => './json-transform.pgx';
=head1 NAME
JSON::Transform::Grammar - JSON::Transform grammar
=
SYNOPSIS
use Pegex::Parser;
use JSON::Transform::Grammar;
use Pegex::Tree::Wrap;
use Pegex::Input;
my $parser = Pegex::Parser->new(
grammar => JSON::Transform::Grammar->new,
receiv
e JSON::Transform grammar.
=head1 METHODS
=head2 make_tree
Override method from L<Pegex::Grammar>.
=cut
sub make_tree { # Generated/Inlined by Pegex::Grammar (0.67)
{
'+grammar' => 'json-
sheet::Wright::JSON;
use 5.010;
use strict;
use warnings;
no warnings qw( uninitialized numeric );
BEGIN {
$Spreadsheet::Wright::JSON::VERSION = '0.107';
$Spreadsheet::Wright::JSON::AUTHORITY =
'cpan:TOBYINK';
}
use Carp;
use JSON;
use parent qw(Spreadsheet::Wright);
sub new
{
my ($class, %args) = @_;
my $self = bless { 'options' => \%args }, $class;
$self->{'_FILENAME'} = $args{'file'
{'_FH'}->print(
to_json($self->{'data'}->{$self->{'_WORKSHEET'}}, $self->{'json_options'})
);
}
else
{
$self->{'_FH'}->print(
to_json($self->{'data'}, $self->{'json_options'})
);
}
JSON;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.003';
use portable::lib;
use portable::loader;
sub init {
my $me = shift;
my ($loader) = @_;
$loader->register_extension('portable.json
ur $decoder;
sub parse {
my $me = shift;
my ($filename) = @_;
require JSON::Eval;
$decoder ||= JSON::Eval->new;
my $jsontext = do {
open my $fh, '<', $filename
or die "Could not open $filen
ame: $!";
local $/;
<$fh>;
};
return ($filename => $decoder->decode($jsontext));
}
1;
kage JSON::Transform;
use strict;
use warnings;
use Exporter 'import';
use Storable qw(dclone);
use JSON::Transform::Grammar;
use XML::Invisible qw(make_parser);
use constant DEBUG => $ENV{JSON_TRAN
%IS_BACKSLASH_ENTITY = map {$_=>1} qw(
jsonBackslashDouble
jsonBackslashDollar
jsonBackslashQuote
jsonBackslashGrave
);
my $parser = make_parser(JSON::Transform::Grammar->new);
sub parse_tra
$topdata, $destptr, $newdata, $uservals) = @_;
my $name = $destptr->{nodename};
if ($name eq 'jsonPointer') {
$destptr = _eval_expr($topdata, $destptr, _make_sysvals(), $uservals, 1);
_poi
JSON::MicrosoftDateFormat;
use strict;
use warnings;
use DateTime;
our $VERSION = '0.05';
our $PACKAGE = __PACKAGE__;
=head1 NAME
DateTime::Format::JSON::MicrosoftDateFormat - Parse and format JSON
osoftDateFormat strings
=head1 SYNOPSIS
use DateTime::Format::JSON::MicrosoftDateFormat;
my $formatter = DateTime::Format::JSON::MicrosoftDateFormat->new;
my $dt = $formatter->parse_da
:JSON::MicrosoftDateFormat -e 'print DateTime::Format::JSON::MicrosoftDateFormat->new->parse_datetime(shift), "\n";' '/Date(1392606509000-0500)/'
=head1 DESCRIPTION
This module understands the JSON
JSON::Eval;
require Carp;
Carp::croak($@);
};
package JSON::Eval;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.002';
use Scalar::Util qw(blessed);
sub new {
my $class = shift;
my $json
= @_ ? $_[0] : do { require JSON::MaybeXS; JSON::MaybeXS->new };
bless \$json, $class;
}
sub AUTOLOAD {
my $self = shift;
our $AUTOLOAD;
( my $method = $AUTOLOAD ) =~ s/.*:://;
my $r = $$self->
{
require Carp;
Carp::croak("Cannot serialize coderef that closes over lexical variables to JSON: ".join ",", sort keys %$lexicals);
}
require B::Deparse;
my $dp = 'B::Deparse'->new;
$dp