package JSON;
use strict;
use Carp ();
use Exporter;
BEGIN { @JSON::ISA = 'Exporter' }
@JSON::EXPORT = qw(from_json to_json jsonToObj objToJson encode_json decode_json);
BEGIN {
$JSON::VERSION
$JSON::DEBUG = 0 unless (defined $JSON::DEBUG);
$JSON::DEBUG = $ENV{ PERL_JSON_DEBUG } if exists $ENV{ PERL_JSON_DEBUG };
}
my %RequiredVersion = (
'JSON::PP' => '2.27203',
'JSON::X
ore space_after relaxed canonical allow_nonref
allow_blessed convert_blessed filter_json_object filter_json_single_key_object
shrink max_depth max_size encode decode decode_prefix allow_unkn
JSON::Dumper::Compact;
use JSON::MaybeXS;
use Mu::Tiny;
use Class::Method::Modifiers;
our $VERSION = '0.006000';
$VERSION =~ tr/_//d;
extends 'Data::Dumper::Compact';
lazy json_obj => sub {
JSON
>filter_json_single_key_object(__bless__ => sub {
bless($_[0][1], $_[0][0]);
});
};
sub _json_decode { shift->json_obj->decode(@_) }
sub _build_dumper { my $j = shift->json_obj; su
{ $j->encode($_[0]) } }
sub _format_el { shift->_format(@_).',' }
sub _format_hashkey { $_[0]->json_obj->encode($_[1]).':' }
sub _format_string { '"'.$_[1].'"' }
sub _format_thing { $_[1] }
arou
ForceContent => 1,
}
],
json => [
{ # For serialize
utf8 => 0,
ort extending.
Now allowed to use follows formats of serialization in this base class:
XML, YAML, JSON and "none" for automatic format detecting
=head2 new
my $sr = CTK::Serializer->new( $format
mats:
=over 8
=item C<XML>
XML serialization via XML::Simple module
=item C<JSON>
JSON serialization via JSON (JSON::XS if installed) module
=item C<YAML>
YAML serialization via YAML::XS module
=head1 NAME
C<PickLE::Exporter::JSON> - Converts a PickLE document to JSON.
=cut
package PickLE::Exporter::JSON;
use strict;
use warnings;
use autodie;
use JSON::MaybeXS;
use PickLE::Document;
HODS
=over 4
=item I<$%json> = C<PickLE::Exporter::JSON>->C<as_hash>(I<$document>)
Converts a PickLE I<$document> into a hash reference that can be easily
converted to JSON by any of the common lib
raries.
=cut
sub as_hash {
my ($class, $document) = @_;
my $json = {
doctype => 'pickle',
version => 1,
name => undef,
revision => undef,
description => undef,
properties => [],
cate
package Catalyst::View::Errors::JSON;
use Moose;
use JSON::MaybeXS;
use CatalystX::Utils::ContentNegotiation;
use CatalystX::Utils::ErrorMessages;
extends 'Catalyst::View';
has extra_encoder_args =
JSON::MaybeXS->new(utf8=>1, %{shift->extra_encoder_args}) },
);
sub http_default {
my ($self, $c, $code, %args) = @_;
my $message_info = $self->finalize_message_info($c, $code, %args);
my $json
= $self->render_json($c, $message_info);
$c->response->body($json);
$c->response->content_type('application/json');
$c->response->status($code);
}
sub finalize_message_info {
my ($self, $c
package JSON::Whitespace;
use warnings;
use strict;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw/json_minify/;
our %EXPORT_TAGS = (
all => \@EXPORT_OK,
);
use warnings;
use stri
ION = '0.62';
use JSON::Tokenize 'tokenize_json';
sub json_minify
{
my ($json) = @_;
my $tokens = tokenize_json ($json);
my $nospace = strip_whitespace ($tokens, $json);
return $nosp
package JSON::Tokenize;
use warnings;
use strict;
require Exporter;
our @ISA = qw(Exporter);
use JSON::Parse;
our @EXPORT_OK = qw/
tokenize_child
tokenize_end
tokenize_json
tokenize_ne
ut, $token) = @_;
if (! $input || ! $token) {
croak "tokenize_text requires input string and JSON::Tokenize object";
}
my $start = tokenize_start ($token);
my $length = tokenize_end (
package JSON::JQ;
use strict;
use warnings;
use Carp;
our $VERSION = '0.09';
# internal flags
our $DEBUG = 0;
our $DUMP_DISASM = 0;
use FindBin ();
FindBin::again();
use POSIX qw/i
satty/;
use Path::Tiny qw/path/;
use JSON qw/from_json/;
# jv_print_flags in jv.h
use enum qw/BITMASK:JV_PRINT_ PRETTY ASCII COLOR SORTED INVALID REFCOUNT TAB ISATTY SPACE0 SPACE1 SPACE2/;
# jq
.h
use enum qw/:JQ_DEBUG_=1 TRACE TRACE_DETAIL TRACE_ALL/;
use XSLoader;
XSLoader::load('JSON::JQ', $VERSION);
sub new {
my ( $pkg, $param ) = @_;
croak "script or script_file para
age JSON::Parse;
use warnings;
use strict;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw/
assert_valid_json
json_file_to_perl
json_to_perl
parse_json
parse_json_sa
fe
read_json
valid_json
validate_json
/;
our %EXPORT_TAGS = (
all => \@EXPORT_OK,
);
use Carp;
our $VERSION = '0.62';
require XSLoader;
XSLoader::load (__PACKAGE__, $VERSION);
# Expe
rimental, return a string of JSON as the error.
our $json_diagnostics;
# JSON "null" value. Although we're now using PL_sv_yes and PL_sv_no,
# we don't use PL_sv_undef, because perldoc perlguts says
package Test::JSON::Type;
use base qw(Test::Builder::Module);
use strict;
use warnings;
use Cpanel::JSON::XS;
use Cpanel::JSON::XS::Type;
use English;
use Error::Pure qw(err);
use Readonly;
use Test
y our @EXPORT => qw(cmp_json_types is_json_type);
our $VERSION = 0.04;
sub cmp_json_types {
my ($json, $json_expected, $test_name) = @_;
if (! defined $json) {
err 'JSON string to compare is re
$json_expected) {
err 'Expected JSON string to compare is required.';
}
my $test = __PACKAGE__->builder;
my $json_obj = Cpanel::JSON::XS->new;
my $type_hr;
eval {
$json_obj->decode($json,
PTD::JSON;
$Lingua::PTD::JSON::VERSION = '1.17';
use warnings;
use strict;
use parent 'Lingua::PTD';
use JSON;
=encoding UTF-8
=head1 NAME
Lingua::PTD::JSON - Sub-module to export PTD to JSON
=he
ad1 SYNOPSIS
use Lingua::PTD;
my $ptd = Lingua::PTD->new( $file );
$ptd->saveAs("json", $dest, $options);
=head1 DESCRIPTION
Check L<<Lingua::PTD>> for complete reference.
=head1 SEE ALSO
, $filename or return 0;
$contents = <IN>;
close IN;
}
my $self = decode_json($contents);
bless $self => $class #amen
}
use Data::Structure::Util qw( unbless );
sub _sav
package Plack::Middleware::Signposting::JSON;
our $VERSION = '0.06';
use Catmandu::Sane;
use Catmandu;
use Catmandu::Fix;
use JSON qw(decode_json);
use Plack::Request;
use Plack::Util::Accessor qw(f
($res->[1], 'Content-Type') || '';
# only json responses
return unless $content_type =~ m{^application/json|application\/vnd\.api\+json}i;
# ignore streaming response for now
s ref $res->[2] eq 'ARRAY';
my $body = join('', @{$res->[2]});
my $data = decode_json($body);
if (ref $data && ref $data eq 'ARRAY') {
$data = $data->[0];
package App::Codeowners::Formatter::JSON;
# ABSTRACT: Format codeowners output as JSON
use warnings;
use strict;
our $VERSION = '0.51'; # VERSION
use parent 'App::Codeowners::Formatter';
use App:
eval { require JSON::MaybeXS } or die "Missing dependency: JSON::MaybeXS\n";
my %options;
$options{pretty} = 1 if lc($self->format) eq 'pretty';
my $json = JSON::MaybeXS->new(canon
print { $self->handle } $json->encode($results);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
App::Codeowners::Formatter::JSON - Format codeowners output as JSON
=head1 VERSION
version 0.
package Authen::Pluggable::JSON;
$Authen::Pluggable::JSON::VERSION = '0.03';
use Mojo::Base -base, -signatures;
use Mojo::UserAgent;
use Mojo::URL;
has 'parent' => undef, weak => 1;
has _cfg => sub
shift)->query( user => shift, pass => shift );
},
res_builder => sub($json) {return %$json ? $json : undef },
};
};
sub authen ( $s, $user, $pass ) {
my $ub = $s->_cfg->{query
my $ua = Mojo::UserAgent->new;
my $res = $ua->get($url)->result;
return $rb->( $res->json ) if ( $res->is_success );
return undef;
}
sub cfg ( $s, %cfg ) {
if (%cfg) {
w
package JSON::UnblessObject;
use strict;
use warnings;
use parent qw(Exporter);
our $VERSION = "0.02";
our @EXPORT_OK = qw(
unbless_object
);
use Scalar::Util qw(blessed);
use List::Util qw(an
stant JSON_TYPE_ARRAYOF_CLASS => 'Cpanel::JSON::XS::Type::ArrayOf';
use constant JSON_TYPE_HASHOF_CLASS => 'Cpanel::JSON::XS::Type::HashOf';
use constant JSON_TYPE_ANYOF_CLASS => 'Cpanel::JSON::XS:
e_json_type_arrayof($object, $spec) if $spec->isa(JSON_TYPE_ARRAYOF_CLASS);
return resolve_json_type_hashof($object, $spec) if $spec->isa(JSON_TYPE_HASHOF_CLASS);
return resolve_json_
package JSON::Client;
use warnings;
use strict;
use utf8;
use Carp;
use JSON::Parse '0.61', 'valid_json';
use JSON::Create '0.35';
use JSON::Server;
use IO::Socket;
our $VERSION = '0.03';
sub new
{
verbose => $verbose,
jc => JSON::Create->new (downgrade_utf8 => 1,),
jp => JSON::Parse->new (),
};
$client->{jp}->upgrade_utf8 (1);
return $client;
}
sub JSON::Client::send
{
my ($j
@_;
if (! $input) {
carp "Nothing to send";
return {error => 'empty input'};
}
my $json_msg = $jcl->{jc}->run ($input);
my $sock = make_sock ($jcl->{port});
if (! $sock) {
retu
package JSON::Server;
use warnings;
use strict;
use Carp;
use utf8;
our $VERSION = '0.03';
use IO::Socket;
use IO::Select;
use JSON::Create '0.35', ':all';
use JSON::Parse '0.61', ':all';
$SIG{PIPE}
t specified";
}
$gs->{jc} = JSON::Create->new (
indent => 1,
sort => 1,
downgrade_utf8 => 1,
);
$gs->{jc}->bool ('boolean');
$gs->{jp} = JSON::Parse->new ();
$gs->{jp}->upgr
valid_json ($got)) {
if ($gs->{verbose}) {
vmsg ("Not valid json");
}
$gs->reply ($fh, {error => 'invalid JSON'});
next;
}
if ($gs->{verbose}) {
vmsg ("Validated as JSON");
r::JSON
#ABSTRACT: JSON serialization plugin for Raisin.
use strict;
use warnings;
package Raisin::Encoder::JSON;
$Raisin::Encoder::JSON::VERSION = '0.94';
use JSON::MaybeXS qw();
my $json = JSON::
ation/json text/x-json text/json json)] }
sub content_type { 'application/json; charset=utf-8' }
sub serialize { $json->allow_blessed->convert_blessed->encode($_[1]) }
sub deserialize { $json->allo
d->decode($_[1]->content) }
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Raisin::Encoder::JSON - JSON serialization plugin for Raisin.
=head1 VERSION
version 0.94
=head1 DESCRIPTION
Provides
package JSON::Schema::ToJSON;
use strict;
use warnings;
use B;
use Mojo::Base -base;
use Cpanel::JSON::XS;
use String::Random;
use Hash::Merge qw/ merge /;
use Data::Fake qw/ Core Names Text Dates /
/;
our $VERSION = '0.20';
has _validator => sub {
$ENV{JSON_VALIDATOR_RECURSION_LIMIT} = shift->max_depth;
require JSON::Validator;
JSON::Validator->new
};
has _str_rand => sub { String::Rand
0 };
sub json_schema_to_json {
my ( $self,%args ) = @_;
my $schema = $args{schema}; # an already parsed JSON schema
if ( ! $schema ) {
$schema = $args{schema_str} # an unparsed JSON schema
package mb::JSON;
######################################################################
#
# mb::JSON - a simple JSON parser for multibyte string
#
# http://search.cpan.org/dist/mb-JSON/
#
# Copyright
parse JSON data
sub mb::JSON::parse {
local $_ = @_ ? $_[0] : $_;
my $U0 = ($] =~ /^5\.006/) ? 'U0' : '';
my $parsed = '';
while (not /\G \z/xmsgc) {
# beginning of JSON's str
------------------------------------------------------------------------
# end of JSON's string then ":" --> Perl's hash key
#------------------------------------------