package Wiki::JSON::Parser;
use v5.16.3;
use strict;
use warnings;
use Moo;
use Data::Dumper;
use Const::Fast;
const my $MAX_HX_SIZE => 6;
const my $EXTRA
coding utf8
=head1 NAME
Wiki::JSON - Parse wiki-like articles to a data-structure transformable to JSON.
=head1 SYNOPSIS
use Wiki::JSON;
my $structure = Wiki::JSON->new->parse(<<'EOF');
= This is
iki-JSON.git
=head2 USING AS A COMMAND
wiki2json file.wiki > output.json
=head1 INSTANCE METHODS
=head2 new
my $wiki_parser = Wiki::JSON->ne
package Wiki::JSON;
use v5.16.3;
use strict;
use warnings;
use Moo;
use Data::Dumper;
use Const::Fast;
use Wiki::JSON::Parser;
use Wiki::JSON::HTML;
our $VERSION = "0.0.31";
const my $MAX_HX_SIZE
tions]';
}
my ( $self, $wiki_text, $options ) = @_;
$options //= {};
return Wiki::JSON::Parser->new->parse($wiki_text, $options);
}
sub pre_html {
my ($self, $wiki_text, $template
turn Wiki::JSON::HTML->new->pre_html_json($wiki_text, $template_callbacks);
}
1;
=encoding utf8
=head1 NAME
Wiki::JSON - Parse wiki-like articles to a data-structure transformable to JSON.
=head1
ting, however the code of this development version may be broken!
package Math::Formula::Config::JSON;{
our $VERSION = '0.18';
}
use parent 'Math::Formula::Config';
use warnings;
use strict;
use L
calar::Util qw/blessed/;
use File::Slurper qw/read_binary/;
use Cpanel::JSON::XS ();
my $json = Cpanel::JSON::XS->new->pretty->utf8->canonical(1);
#--------------------
#-----------------
for($args{filename} || "$name.json");
open my $fh, '>:raw', $fn
or fault __x"Trying to save context '{name}' to {file}", name => $name, file => $fn;
$fh->print($json->encode($tree));
$fh->close
#
# Perl Runtime for JSON Model
#
package JSON::JsonModel;
use 5.006;
use strict;
use warnings;
# no Carp, this modules runs with automatically generated code, all issues are ours?
our $VERSION =
.999003;
use re::engine::RE2; # replace regex engine
use List::Util qw( min );
use JSON::MaybeXS qw( decode_json is_bool );
use Getopt::Long qw(:config no_ignore_case);
use Time::HiRes 'time';
use
tarts_with
jm_ends_with
jm_main
);
# use constant TRUE => decode_json("true", 1);
# use constant FALSE => decode_json("false", 1);
# WTF
sub jm_raw_is_numeric($)
{
my ($n) = @_;
retu
package Data::Ref::JSON;
use strict;
use Carp;
use warnings;
use diagnostics;
use Data::Dumper;
use Try::Tiny;
# 0 is 'disabled'
my $debugLevel=0;
BEGIN {
use Exporter ();
use vars qw($VERS
ess it
This can be used as an object or a procedure
=cut
=head2 As Procedure
use Data::Ref::JSON qw(walk);
my %tc = (
'HL01-01' => {
'HL02-01' => [
'element 0',
=> 'this is key 6'
}
}
);
walk(\%tc);
=cut
=head2 As Object
use Data::Ref::JSON;
my %tc = (
'HL01-01' => {
'HL02-01' => [
'element 0',
# https://pjcj.net
package Devel::Cover::Report::Json;
use strict;
use warnings;
our $VERSION = '1.51'; # VERSION
use Devel::Cover::DB::IO::JSON;
# use Devel::Cover::Dumper; # For debugging
sub
my $json = { runs => add_runs($db), summary => $db->{summary} };
# print "JSON: ", Dumper $json;
print "JSON sent to $options->{outputdir}/cover.json\n";
my $io = Devel::Cover::DB::IO::JSON->ne
($json, "$options->{outputdir}/cover.json");
}
1
__END__
=head1 NAME
Devel::Cover::Report::Json - JSON backend for Devel::Cover
=head1 VERSION
version 1.51
=head1 SYNOPSIS
cover -report json
:JSON;
use strict;
use warnings;
use base "Devel::Cover::DB::IO::Base";
use JSON::MaybeXS ();
our $VERSION = '1.51'; # VERSION
sub new {
my $class = shift;
my %args = @_;
my $json = JSON:
, allow_blessed => 1);
$json->ascii->pretty->canonical
if exists $args{options} && $args{options} =~ /\bpretty\b/i;
my $self = $class->SUPER::new(%args, json => $json);
bless $self, $class
}
y ($fh) = @_;
local $/;
my $data = eval { $self->{json}->decode(<$fh>) };
die "Can't read $file with ", (ref $self->{json}), ": $@" if $@;
$data
}
)
}
sub write {
my $
package Catmandu::Fix::from_json;
use Catmandu::Sane;
our $VERSION = '1.2025';
use Cpanel::JSON::XS ();
use Moo;
use Catmandu::Util::Path qw(as_path);
use namespace::clean;
use Catmandu::Fix::Has;
_fixer {
my ($self) = @_;
my $json = Cpanel::JSON::XS->new->utf8(0)->pretty(0)->allow_nonref(1);
as_path($self->path)->updater(if_string => sub {$json->decode($_[0])});
}
1;
__END__
=po
d
=head1 NAME
Catmandu::Fix::from_json - replace a json field with the parsed value
=head1 SYNOPSIS
from_json(my.field)
=head1 SEE ALSO
L<Catmandu::Fix>
=cut
package Catmandu::Fix::to_json;
use Catmandu::Sane;
our $VERSION = '1.2025';
use Cpanel::JSON::XS ();
use Catmandu::Util::Path qw(as_path);
use Moo;
use namespace::clean;
use Catmandu::Fix::Has
$json = Cpanel::JSON::XS->new->utf8(0)->pretty(0)->allow_nonref(1);
as_path($self->path)->updater(
if => [
[qw(maybe_value array_ref hash_ref)] => sub {
$json-
}
]
);
}
1;
__END__
=pod
=head1 NAME
Catmandu::Fix::to_json - convert the value of a field to json
=head1 SYNOPSIS
to_json(my.field)
=head1 SEE ALSO
L<Catmandu::Fix>
=cut
tmandu::Serializer::json;
use Catmandu::Sane;
our $VERSION = '1.2025';
use Cpanel::JSON::XS ();
use Moo;
use namespace::clean;
sub serialize {
Cpanel::JSON::XS::encode_json($_[1]);
}
sub dese
rialize {
Cpanel::JSON::XS::decode_json($_[1]);
}
1;
__END__
=pod
=head1 NAME
Catmandu::Serializer - A (de)serializer from and to json
=head1 SYNOPSIS
package MyPackage;
use Moo;
my $obj = MyPackage->new;
my $obj = MyPackage->new(serializer => 'json');
$obj->serialize( { foo => 'bar' } ); # JSON
$obj->deserialize( "{'foo':'bar'}" ); # Perl
=head1 SEE ALSO
L
e Event::RPC::Message::JSON;
use base Event::RPC::Message::SerialiserBase;
use strict;
use utf8;
use JSON::XS 3.0;
my $decoder = JSON::XS->new->allow_tags;
my $encoder = JSON::XS->new->latin1->all
ge::JSON - JSON message formatting
=head1 SYNOPSIS
# Internal module. No documented public interface.
=head1 DESCRIPTION
This module implements the message formatting of Event::RPC
using JSON. O
package Valiant::JSON::Util;
use warnings;
use strict;
use Exporter 'import';
our @EXPORT_OK = qw(escape_javascript);
our %EXPORT_TAGS = (all => \@EXPORT_OK);
my %JS_ESCAPE_MAP = (
'\\' => '\\\
}
1;
=head1 NAME
Valiant::Util - Importable utility methods;
=head1 SYNOPSIS
use Valiant::JSON::Util 'escape_javascript';
=head1 DESCRIPTION
Just a place to stick various utility functio
package Catmandu::Importer::JSON;
use Catmandu::Sane;
our $VERSION = '1.2025';
use Cpanel::JSON::XS ();
use Moo;
use namespace::clean;
with 'Catmandu::Importer';
has line_delimited => (is => 'r
uffer_size => (is => 'ro', default => sub {256});
has json => (is => 'lazy');
sub _build_json {
my ($self) = @_;
Cpanel::JSON::XS->new->utf8($self->encoding eq ':raw');
}
sub _bu
return sub {
state $json = $self->json;
state $fh = $self->fh;
if (defined(my $line = <$fh>)) {
return $json->decode($line);
}
ackage Net::RDAP::JSON;
use JSON qw(-no_export);
use vars qw(@EXPORT $JSON);
use base qw(Exporter);
use strict;
@EXPORT = qw(encode_json decode_json to_json from_json);
$JSON = JSON->new->utf8->cano
code_json { $JSON->encode(@_) }
sub to_json { $JSON->encode(@_) }
sub decode_json { $JSON->decode(@_) }
sub from_json { $JSON->decode(@_) }
1;
__END__
=pod
=head1 NAME
L<Net::RDAP::JSON> -
a wrapper to allow JSON backends to be switched.
=head1 DESCRIPTION
This module is a wrapper around L<JSON>. It exists to make it easier to switch
the JSON module used by L<Net::RDAP>. You should no
package Catmandu::Exporter::JSON;
use Catmandu::Sane;
our $VERSION = '1.2025';
use Cpanel::JSON::XS ();
use Moo;
use namespace::clean;
with 'Catmandu::Exporter';
has line_delimited => (is => 'ro'
anonical => (is => 'ro', default => sub {0});
has json => (is => 'lazy');
sub _build_json {
my ($self) = @_;
Cpanel::JSON::XS->new->utf8(0)
->allow_nonref->pretty($self
my $json = $self->json->encode($data);
if ($self->line_delimited) {
print $fh $json;
print $fh "\n";
return;
}
if ($self->pretty) {
chomp $json;
}
package Valiant::JSON::JSONBuilder;
use Moo;
use Carp;
use Scalar::Util 'blessed';
use Module::Runtime 'use_module';
use Cpanel::JSON::XS ();
use Valiant::HTML::Util::Collection;
use Valiant::Naming;
has 'json_args' => (
is => 'ro',
required => 1,
default => sub { +{} },
);
has 'json' => (
is => 'ro',
required => 1,
lazy => 1,
default => sub {
my %args = %{ shift->json_args
};
return Cpanel::JSON::XS->new(%args, utf8=>1, pretty=>1);
},
handles => {
encode_json => 'encode',
},
);
sub reset {
my ($self) = @_;
$self->data(+{ data => +{} });
$self->clear
package Mojo::File::Role::JSON;
# # ABSTRACT: adds a json method to Mojo::File to store and retrieve JSON
# use Mojo::Base -role;
# use Mojo::Util qw/dumper/;
# use JSON::MaybeXS;
# use Hash::Merg
sub json {
# my $self = shift;
# if (@_) {
# unless (-f $self) { $self->dirname->make_path }
# my $json = JSON::MaybeXS->new->pretty($pretty)->utf8->encode(shift());
# $self->spew($json);
#
if (want('OBJECT')) {
# rreturn $self;
# } else {
# rreturn $self->json;
# }
# }
# return undef unless -f $self;
# # if ($self->policy eq "die") {
# # die sprintf qq(Fi
e CSAF::Renderer::JSON;
use 5.010001;
use strict;
use warnings;
use utf8;
use Cpanel::JSON::XS;
use Moo;
extends 'CSAF::Renderer::Base';
sub render {
my $json = Cpanel::JSON::XS->new->utf8->c
af->build;
my $json_string = $json->encode($csaf);
return $json_string;
}
1;
__END__
=encoding utf-8
=head1 NAME
CSAF::Renderer::JSON - Render a CSAF document in JSON
=head1 SYNOPSIS
enderer::JSON;
my $renderer = CSAF::Renderer::JSON->new( csaf => $csaf );
my $json = $renderer->render;
=head1 DESCRIPTION
L<CSAF::Renderer::JSON> render the CSAF document in JSON format.
Parser::JSON;
use strict;
use warnings;
use base qw(WebService::Simple::Parser);
use JSON 2.0;
sub new
{
my $class = shift;
my %args = @_;
my $json = delete $args{json} || JSON->new;
ER::new(%args);
$self->{json} = $json;
return $self;
}
sub parse_request
{
my $self = shift;
# my $content = $_[0]->decoded_content;
# # JSONP to pure JSON
# $content =~ s/[a-zA-Z_\
.+)\)\s*;?\s*$/$1/;
$self->{json}->encode( $_[0] );
}
sub parse_response
{
my $self = shift;
my $content = $_[0]->decoded_content;
# JSONP to pure JSON
$content =~ s/[a-zA-Z_\$][a
e JSON::Relaxed::ErrorCodes;
use JSON::Relaxed::Parser; our $VERSION = $JSON::Relaxed::Parser::VERSION;
=head1 JSON::Relaxed::ErrorCodes -- Error messages
If the document cannot be parsed, JSON::R
cy mode, JSON::Relaxed returns an undefined
value instead and sets the following error indicators:
=over 4
=item * $JSON::Relaxed::err_id
A unique code for a specific error.
=item * $JSON::Relaxed
ieved using
the parser methods err_id() and err_msg().
Following is a list of all error codes in JSON::Relaxed:
=over 4
=item * C<missing-input>
No input was found. This can be caused by:
$pa