NAME
MarpaX::ESLIF::ECMA404 - JSON Data Interchange Format following ECMA-404 specification
VERSION
version 0.008
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.
SUBROUTINES/METHODS
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
orinf
, 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, or undef
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
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.