NAME
MarpaX::ESLIF::JSON::Decoder - ESLIF's JSON decoder interface
VERSION
version 6.0.35.1
DESCRIPTION
This is JSON's strict and relax decoder writen directly in MarpaX::ESLIF library.
There are two JSON modes:
- Strict
-
Encoder and decoder are strict, as per ECMA-404 The JSON Data Interchange Standard.
- Relax
-
This is strict grammar extended with:
METHODS
MarpaX::ESLIF::JSON::Decoder->new($eslif[, $strict])
my $eslifJSONDecoder = MarpaX::ESLIF::JSON::Decoder->new($eslif);
Returns a JSON grammar instance, noted $eslifJSONDecoder
later. Parameters are:
$eslif
-
MarpaX::ESLIF object instance. Required.
$strict
-
A true value means strict JSON, else relax JSON. Default is a true value.
$eslifJSONDecoder->decode($string, %options)
my $value = $eslifJSONDecoder->decode($string);
Returns a value containing decoded $string
. In relax mode, special floating point are supported:
+Infinity
-
Positive infinity, either as a native floating point number if the underlying system supports that, or as a
Math::BigInt->binf()
instance. -Infinity
-
Negative infinity, either as a native floating point number if the underlying system supports that, or as a
Math::BigInt->binf('-')
instance. NaN
-
Not-a-Number, either as a native floating point number if the underlying system supports that, or as a
Math::BigInt->bnan()
instance.
Supported options are:
- encoding
-
Input encoding. Can be
undef
. - disallowDupkeys
-
A true value will disallow duplicate keys. Default is a false value.
- maxDepth
-
Maximum depth. Default is 0, meaning no limit.
- noReplacementCharacter
-
A true value will disallow UTF-8 replacement character for invalid UTF-16 surrogates. Default is a false value.
NOTES
Formally, the JSON implementation is only a grammar coded directly in the ESLIF library, therefore this module inherits from MarpaX::ESLIF::Grammar.
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.