package Venus::Json;
use 5.018;
use strict;
use warnings;
use overload (
'""' => 'explain',
'~~' => 'explain',
fallback => 1,
);
use Venus::Class 'attr', 'base', 'with';
base 'Venus::Kind::
($package->can('escape_slash')) {
$package->escape_slash;
}
# Cpanel::JSON::XS
if ($package->isa('Cpanel::JSON::XS')) {
$self->decoder(sub {
my ($text) = @_;
$package->decod
coder(sub {
my ($data) = @_;
$package->encode($data);
});
}
# JSON::XS
if ($package->isa('JSON::XS')) {
$self->decoder(sub {
my ($text) = @_;
$package->decode($t
package App::AutoCRUD::View::Json;
use 5.010;
use Moose;
extends 'App::AutoCRUD::View';
use JSON::MaybeXS;
use namespace::clean -except => 'meta';
has 'json_args' => ( is => 'bare', isa =>
encode output
my $json_maker = JSON::MaybeXS->new(%{$self->{json_args}});
my $output = $json_maker->encode($data);
return [200, ['Content-type' => 'application/json; charset=UTF-8'],
package Error::Pure::HTTP::JSON;
use base qw(Exporter);
use strict;
use warnings;
use Error::Pure::Output::JSON qw(err_json);
use Error::Pure::Utils qw(err_helper);
use List::Util 1.33 qw(none);
use
^eval '/ms }
map { $_->{'sub'} } @{$stack_ar}) {
print "Content-type: application/json\n\n";
print err_json(\@errors);
return;
# Die for eval.
} else {
my $e = $errors[-1]->{'msg'}->[0];
d
=encoding utf8
=head1 NAME
Error::Pure::HTTP::JSON - Error::Pure module for JSON output over HTTP.
=head1 SYNOPSIS
use Error::Pure::HTTP::JSON qw(err);
err 'This is a fatal error', 'name', '
package Error::Pure::HTTP::JSON::Advance;
use base qw(Exporter);
use strict;
use warnings;
use Error::Pure::Output::JSON qw(err_json);
use Error::Pure::Utils qw(err_helper);
use List::Util 1.33 qw(n
{$key} = $ERR_PARAMETERS{$key};
}
# Print out.
print "Content-type: application/json\n\n";
print err_json($err_hr);
return;
# Die for eval.
} else {
my $e = $errors[-1]->{'msg'}->[0];
=head1 NAME
Error::Pure::HTTP::JSON::Advance - Error::Pure module for JSON output with additional parameters over HTTP.
=head1 SYNOPSIS
use Error::Pure::HTTP::JSON::Advance qw(err);
err 'This i
ckage PGObject::Type::JSON;
use 5.010;
use strict;
use warnings;
use PGObject;
use JSON;
use Carp 'croak';
use Scalar::Util 'blessed';
=head1 NAME
PGObject::Type::JSON - JSON wrappers for PGObject
OBject::Type::JSON->register();
Columns of type json will be converted into hashrefs
my $obj = PGOBject::Type::JSON->new($hashref);
$obj will now serialize to the database as json.
=head1 DESC
RIPTION
This module allows json types or others (specified by custom register) types to
be converted from JSON into objects according to their values.
This module assumes that encoding will be in UT
package JSON::Any; # git description: v1.39-25-gd13a0fd
use warnings;
use strict;
our $VERSION = '1.40';
use Carp qw(croak carp);
# ABSTRACT: (DEPRECATED) Wrapper Class for the various JSON classe
s
# KEYWORDS: json serialization serialisation wrapper abstraction
our $UTF8;
my ( %conf, $handler, $encoder, $decoder );
use constant HANDLER => 0;
use constant ENCODER => 1;
use constant DECODER =
EGIN {
%conf = (
json_1 => {
encoder => 'objToJson',
decoder => 'jsonToObj',
get_true => sub { return JSON::True(); },
get_
Reader::JSON 3.000008;
# ABSTRACT: read manifest.json files
use v5.20.0;
use Moose;
with 'Email::MIME::Kit::Role::ManifestReader',
'Email::MIME::Kit::Role::ManifestDesugarer';
use JSON 2;
sub
read_manifest {
my ($self) = @_;
my $json_ref = $self->kit->kit_reader->get_kit_entry('manifest.json');
my $content = JSON->new->utf8->decode($$json_ref);
}
no Moose;
__PACKAGE__->meta->make
ble;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Email::MIME::Kit::ManifestReader::JSON - read manifest.json files
=head1 VERSION
version 3.000008
=head1 PERL VERSION
This library should run
package PICA::Writer::JSON;
use v5.14.1;
our $VERSION = '2.12';
use Scalar::Util qw(reftype);
use JSON::PP;
use PICA::Data;
use parent 'PICA::Writer::Base';
sub write_record {
my ($self, $reco
rd) = @_;
my $json = $self->{json};
unless ($json) {
$json = JSON::PP->new(%$self);
$json->$_($self->{$_})
for grep {exists $self->{$_}}
qw(pretty asci
f->{json} = $json;
}
print {$self->{fh}} $json->encode(PICA::Data::TO_JSON($record));
print {$self->{fh}} "\n" unless $json->get_indent;
}
1;
__END__
=head1 NAME
PICA::Writer::JSON - P
package PICA::Parser::JSON;
use v5.14.1;
our $VERSION = '2.12';
use JSON::PP;
our $JSON = JSON::PP->new;
use parent 'PICA::Parser::Base';
sub _next_record {
my ($self) = @_;
if (my $line
= $self->{reader}->getline) {
my $record = $JSON->decode($line);
$record = $record->{record} if ref $record eq 'HASH';
return $record;
# TODO: cleanup occurrence and
}
}
1;
__END__
=head1 NAME
PICA::Parser::JSON - PICA JSON parser
=head2 DESCRIPTION
This parser parses L<PICA JSON|http://format.gbv.de/pica/json> format. The
current implementation expects re
#
# $Id$
#
# file::json Brik
#
package Metabrik::File::Json;
use strict;
use warnings;
use base qw(Metabrik::File::Text);
sub brik_properties {
return {
revision => '$Revision$',
tags
w($json_hash output_file|OPTIONAL) ],
is_valid => [ qw(input_file|OPTIONAL) ],
},
require_modules => {
'Metabrik::File::Write' => [ ],
'Metabrik::String::Json' =
|| 'utf8',
},
};
}
sub brik_init {
my $self = shift;
my $sj = Metabrik::String::Json->new_from_brik_init($self) or return;
$self->_sj($sj);
return $self->SUPER::brik_init;
}
#
# $Id$
#
# string::json Brik
#
package Metabrik::String::Json;
use strict;
use warnings;
use base qw(Metabrik);
sub brik_properties {
return {
revision => '$Revision$',
tags => [ qw
attributes_default => {
use_utf8 => 1,
},
require_modules => {
'JSON::XS' => [ ],
},
};
}
sub encode {
my $self = shift;
my ($data) = @_;
$self->b
turn;
$self->log->debug("encode: data[$data]");
my $encoded = '';
eval {
my $j = JSON::XS->new;
$j->relaxed(1);
$j->utf8($self->use_utf8);
$encoded = $j->encode($dat
package Perl::Metrics::Simple::Output::JSON;
use strict;
use warnings;
use parent qw(Perl::Metrics::Simple::Output);
use JSON::PP qw(encode_json);
our $VERSION = 'v1.0.3';
sub make_report {
my
mplexity(),
},
subs => $self->make_list_of_subs()->[1],
};
return encode_json($report);
}
sub make_counts {
my ($self) = @_;
my $analysis = $self->analysis();
r
package JSON::PP;
# JSON-2.0
use 5.008;
use strict;
use Exporter ();
BEGIN { our @ISA = ('Exporter') }
use overload ();
use JSON::PP::Boolean;
use Carp ();
use Scalar::Util qw(blessed reftype ref
addr);
#use Devel::Peek;
our $VERSION = '4.17_01';
our @EXPORT = qw(encode_json decode_json from_json to_json);
# instead of hash-access, i tried index-access for speed.
# but this method is not fa
UNKNOWN => 18;
use constant P_ALLOW_TAGS => 19;
use constant USE_B => $ENV{PERL_JSON_PP_USE_B} || 0;
use constant CORE_BOOL => defined &builtin::is_bool;
my $invalid_char_re;
BEGIN
package JSON::PP::Boolean;
use strict;
use warnings;
use overload ();
overload::unimport('overload', qw(0+ ++ -- fallback));
overload::import('overload',
"0+" => sub { ${$_[0]} },
"++"
fallback => 1,
);
our $VERSION = '4.17_01';
1;
__END__
=head1 NAME
JSON::PP::Boolean - dummy module providing JSON::PP::Boolean
=head1 SYNOPSIS
# do not "use" yourself
=head1 DESCRIPTION
verload resolution for Storable and similar modules. See
L<JSON::PP> for more info about this class.
=head1 AUTHOR
This idea is from L<JSON::XS::Boolean> written by Marc Lehmann <schmorp[at]schmorp.
package JSON::RPC2::TwoWay;
use 5.10.0;
use strict;
use warnings;
our $VERSION = '0.08'; # VERSION
# standard perl
use Carp;
use Data::Dumper;
# cpan
use JSON::MaybeXS qw();
# us
use JSON::RPC2::T
y STDERR @_ },
json => $opt{json} // JSON::MaybeXS->new(utf8 => 1),
methods => {},
};
return bless $self, $class;
}
sub newconnection {
my ($self, %opt) = @_;
my $conn = JSON::RPC2::TwoWay::C
r => $opt{owner},
write => $opt{write},
debug => $self->{debug} ? $self->{log} : 0,
json => $self->{json},
);
return $conn
}
sub register {
my ($self, $name, $cb, %opts) = @_;
my %defaults
package JSON::RPC2::TwoWay::Connection;
use 5.10.0;
use strict;
use warnings;
our $VERSION = '0.08'; # VERSION
# standard perl
use Carp;
use Data::Dumper;
use Digest::MD5 qw(md5_base64);
use Scalar
HiRes::time;
# cpan
use JSON::MaybeXS qw();
use constant ERR_REQ => -32600;
sub new {
my ($class, %opt) = @_;
croak 'no rpc?' unless $opt{rpc} and $opt{rpc}->isa('JSON::RPC2::TwoWay');
#croak
@_ },
next_id => 1,
owner => $opt{owner},
request => undef,
rpc => $opt{rpc},
json => $opt{rpc}->{json},
state => undef,
write => $opt{write},
};
weaken $self->{owner};
return bless $
package Error::Pure::JSON;
use base qw(Exporter);
use strict;
use warnings;
use Error::Pure::Output::JSON qw(err_json);
use Error::Pure::Utils qw(err_helper);
use List::MoreUtils qw(none);
use Reado
'
&& none { $_ eq $EVAL || $_ =~ /^eval '/ms }
map { $_->{'sub'} } @{$stack_ar}) {
die err_json(\@errors)."\n";
# Die for eval.
} else {
my $e = $errors[-1]->{'msg'}->[0];
if (! defined
__END__
=pod
=encoding utf8
=head1 NAME
Error::Pure::JSON - Error::Pure module for JSON output.
=head1 SYNOPSIS
use Error::Pure::JSON qw(err);
err 'This is a fatal error', 'name', 'value';
package ColorTheme::JSON::Color::default_ansi;
use strict;
use parent 'ColorThemeBase::Static::FromStructColors';
use Term::ANSIColor qw(:constants);
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
o
'2023-07-02'; # DATE
our $DIST = 'JSON-Color'; # DIST
our $VERSION = '0.134'; # VERSION
our %THEME = (
v => 2,
summary => 'The default color theme for JSON::Color, using ANSI codes',
ite
e default color theme for JSON::Color, using ANSI codes
__END__
=pod
=encoding UTF-8
=head1 NAME
ColorTheme::JSON::Color::default_ansi - The default color theme for JSON::Color, using ANSI codes
package Error::Pure::JSON::Advance;
use base qw(Exporter);
use strict;
use warnings;
use Error::Pure::Output::JSON qw(err_json);
use Error::Pure::Utils qw(err_helper);
use List::MoreUtils qw(none);
};
}
die err_json($err_hr)."\n";
# Die for eval.
} else {
die "$errors[-1]->{'msg'}->[0]\n";
}
return;
}
1;
__END__
=pod
=encoding utf8
=head1 NAME
Error::Pure::JSON::Advance - Error
::Pure module for JSON output with additional parameters.
=head1 SYNOPSIS
use Error::Pure::JSON::Advance qw(err);
err 'This is a fatal error', 'name', 'value';
=head1 SUBROUTINES
=over 8
=item
package ColorTheme::JSON::Color::default_rgb;
use strict;
use parent 'ColorThemeBase::Static::FromStructColors';
use Graphics::ColorNamesLite::WWW;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our
ST = 'JSON-Color'; # DIST
our $VERSION = '0.134'; # VERSION
my $t = $Graphics::ColorNamesLite::WWW::NAMES_RGB_TABLE;
our %THEME = (
v => 2,
summary => 'The default color theme for JSON::Colo
default color theme for JSON::Color, using RGB color codes
__END__
=pod
=encoding UTF-8
=head1 NAME
ColorTheme::JSON::Color::default_rgb - The default color theme for JSON::Color, using RGB color