use Object::Pad;
use utf8;
package JSON::Relaxed::Parser;
our $VERSION = "0.098";
class JSON::Relaxed::Parser;
# Instance data.
field $data :mutator; # RJSON string being parser
field @pretoks;
tandard.
# Strict true -> RJSON conformant.
# Strict false (default) -> RRJSON. Everything goes :).
field $strict :mutator :param = 0;
# Allow extra stuff after the JSON structure.
# Strict mode
input
if ( $booleans ) {
if ( ref($booleans) ne 'ARRAY' ) {
$booleans = [ $JSON::Boolean::false, $JSON::Boolean::true ];
}
}
else {
$booleans = [ 0, 1 ];
}
my $glue = 0;
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
;
use utf8;
package JSON::Relaxed;
use JSON::Relaxed::Parser; our $VERSION = $JSON::Relaxed::Parser::VERSION;
=encoding UTF-8
=head1 NAME
JSON::Relaxed -- An extension of JSON that allows for bet
=head1 Relaxed JSON?
There's been increasing support for the idea of expanding JSON to improve
human-readability.
"Relaxed" JSON (RJSON) is a term that has been used to describe a
JSON-ish format tha
that JSON doesn't.
Most notably, RJSON allows the use of JavaScript-like comments and
eliminates the need to quote all keys and values.
An (official) specification can be found on
L<RelaxedJSON.org|h
=head1 NAME
JSON::Relaxed -- An extension of JSON that allows for better human-readability.
=head1 TAKEOVER
New maintainer,
The minimal perl requirement is raised to 5.26 for future features. If
t
atures will be
implemented in a different module.
=head1 SYNOPSIS
my ($rjson, $hash, $parser);
# raw RJSON code
$rjson = <<'(RAW)';
/* Javascript-like comments are allowed */
{
// single o
allowed like in JSON
c: [
{a:1, b:2},
],
// like Perl, trailing commas are allowed
d: "more stuff",
}
(RAW)
# subroutine parsing
$hash = from_rjson($rjson);
# object-or
erimental::signatures';
# Package name.
my $my_package = 'JSON::Relaxed';
# Program name and version.
my ($my_name, $my_version) = qw( rrjson 0.02 );
################ Command line parameters #######
#########
use Getopt::Long 2.13;
# Command line options.
my $mode = "rrjson";
my $execute; # direct JSON from command line
my $schema; # schema (optional)
# Parser options.
my $strict;
my $pret
n/../lib";
use JSON::Relaxed;
use JSON::PP;
use File::LoadLines;
use Encode qw(decode_utf8);
binmode STDOUT => ':utf8';
binmode STDERR => ':utf8';
if ( $schema ) {
my $parser = JSON::Relaxed::Par