Skip to content

jddurand/MarpaX-ESLIF-ECMA404

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

MarpaX::ESLIF::ECMA404 - JSON Data Interchange Format following ECMA-404 specification

VERSION

version 0.012

SYNOPSIS

use MarpaX::ESLIF::ECMA404;

my $ecma404 = MarpaX::ESLIF::ECMA404->new();
my $input   = '["JSON",{},[]]';
my $json    = $ecma404->decode($input);

DESCRIPTION

This module decodes strict JSON input using MarpaX::ESLIF.

Travis CI build status GitHub version License Perl5

new($class, %options)

Instantiate a new object. Takes as parameter an optional hash of options that can be:

logger

An optional logger object instance that must do methods compliant with Log::Any interface.

and the following extensions:

unlimited_commas

Allow unlimited number of commas between object pairs or array elements.

trailing_separator

Allow trailing separator (i.e. a comma, eventually an unlimited number of them (c.f. unlimited_commas option) after object pairs or array elements.

perl_comment

Allow perl style comments.

cplusplus_comment

Allow C++ style comments.

bignum

Use perl's bignum to store numbers. Default perl's bignum accuracy and precision will be in effect.

inf

Support of infinity or inf, case insensitive, eventually preceded by a + or a - sign.

nan

Support of nan, case insensitive, eventually preceded by a + or a - sign (even if this is meaningless).

cntrl

Support of Unicode's control characters (i.e. the range [\x00-\x1F]).

disallow_dupkeys

Dot not allow duplicate key in an object.

decode($self, $input, $encoding)

Parses JSON that is in $input and returns a perl variable containing the corresponding structured representation (which can be undef), or croaks in case of failure. $encoding is an optional parameter: JSON parser is using MarpaX::ESLIF that will guess about the encoding if not specified, this guess is not 100% reliable - so if you know the encoding of your data, in particular if it is not in UTF-8, you should give the information to the parser. Default is to guess.

SEE ALSO

MarpaX::ESLIF, Log::Any

AUTHOR

Jean-Damien Durand <jeandamiendurand@free.fr>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Jean-Damien Durand.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

About

JSON Data Interchange Format following ECMA-404 specification

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages