Lines Matching defs:JSON

1 package JSON;
7 @JSON::EXPORT = qw(from_json to_json jsonToObj objToJson encode_json decode_json);
10 $JSON::VERSION = '2.59';
11 $JSON::DEBUG = 0 unless (defined $JSON::DEBUG);
12 $JSON::DEBUG = $ENV{ PERL_JSON_DEBUG } if exists $ENV{ PERL_JSON_DEBUG };
15 my $Module_XS = 'JSON::XS';
16 my $Module_PP = 'JSON::PP';
17 my $Module_bp = 'JSON::backportPP'; # included in JSON distribution
40 /; # JSON::PP specific
53 unless ($JSON::Backend) {
54 $JSON::DEBUG and Carp::carp("Check used worker module...");
58 if ($backend eq '1' or $backend =~ /JSON::XS\s*,\s*JSON::PP/) {
61 elsif ($backend eq '0' or $backend eq 'JSON::PP') {
64 elsif ($backend eq '2' or $backend eq 'JSON::XS') {
67 elsif ($backend eq 'JSON::backportPP') {
85 JSON::Backend::XS
86 ->support_by_pp(@PPOnlyMethods) if ($JSON::Backend eq $Module_XS);
119 if (defined $_[0] and UNIVERSAL::isa($_[0], 'JSON')) {
123 return JSON::from_json(@_);
128 if (defined $_[0] and UNIVERSAL::isa($_[0], 'JSON')) {
132 JSON::to_json(@_);
140 ref($_[0]) eq 'JSON'
141 or (@_ > 2 and $_[0] eq 'JSON')
145 my $json = JSON->new;
159 if ( ref($_[0]) eq 'JSON' or $_[0] eq 'JSON' ) {
162 my $json = JSON->new;
175 sub true { $JSON::true }
177 sub false { $JSON::false }
186 $JSON::Backend;
246 $JSON::DEBUG and Carp::carp "Load $Module_XS.";
249 JSON::Boolean::_overrride_overload($Module_XS);
250 JSON::Boolean::_overrride_overload($Module_PP);
258 $JSON::DEBUG and Carp::carp "Can't load $Module_XS...($@)";
265 _set_module( $JSON::Backend = $Module_XS );
269 JSON::Backend::XS->init;
280 $JSON::DEBUG and Carp::carp "Load $backend.";
283 JSON::Boolean::_overrride_overload($Module_XS);
284 JSON::Boolean::_overrride_overload($backend);
295 $JSON::DEBUG and Carp::carp "Can't load $Module_PP ($@), so try to load $Module_bp";
298 JSON::Boolean::_overrride_overload($backend);
306 _set_module( $JSON::Backend = $Module_PP ); # even if backportPP, set $Backend with 'JSON::PP'
307 JSON::Backend::PP->init;
313 return if defined $JSON::true;
320 $JSON::true = ${"$module\::true"};
321 $JSON::false = ${"$module\::false"};
323 push @JSON::ISA, $module;
324 push @{"$module\::Boolean::ISA"}, qw(JSON::Boolean);
326 *{"JSON::is_bool"} = \&{"$module\::is_bool"};
329 *{"JSON::$method"} = sub {
341 # JSON Boolean
344 package JSON::Boolean;
371 if ( exists $INC{'JSON/XS.pm'} and $boolean eq 'JSON::XS::Boolean' ) {
375 *JSON::XS::true = sub () { $true };
376 *JSON::XS::false = sub () { $false };
378 elsif ( exists $INC{'JSON/PP.pm'} and $boolean eq 'JSON::PP::Boolean' ) {
382 *JSON::PP::true = sub { $true };
383 *JSON::PP::false = sub { $false };
394 package JSON::Backend::PP;
398 no strict qw(refs); # this routine may be called after JSON::Backend::XS init was called.
399 *{"JSON::decode_json"} = \&{"JSON::PP::decode_json"};
400 *{"JSON::encode_json"} = \&{"JSON::PP::encode_json"};
401 *{"JSON::PP::is_xs"} = sub { 0 };
402 *{"JSON::PP::is_pp"} = sub { 1 };
410 package JSON;
420 package JSON::Backend::XS;
443 *{"JSON::decode_json"} = \&{"JSON::XS::decode_json"};
444 *{"JSON::encode_json"} = \&{"JSON::XS::encode_json"};
445 *{"JSON::XS::is_xs"} = sub { 1 };
446 *{"JSON::XS::is_pp"} = sub { 0 };
457 my $JSON_XS_encode_orignal = \&JSON::XS::encode;
458 my $JSON_XS_decode_orignal = \&JSON::XS::decode;
459 my $JSON_XS_incr_parse_orignal = \&JSON::XS::incr_parse;
461 *JSON::XS::decode = \&JSON::Backend::XS::Supportable::_decode;
462 *JSON::XS::encode = \&JSON::Backend::XS::Supportable::_encode;
463 *JSON::XS::incr_parse = \&JSON::Backend::XS::Supportable::_incr_parse;
465 *{JSON::XS::_original_decode} = $JSON_XS_decode_orignal;
466 *{JSON::XS::_original_encode} = $JSON_XS_encode_orignal;
467 *{JSON::XS::_original_incr_parse} = $JSON_XS_incr_parse_orignal;
469 push @JSON::Backend::XS::Supportable::ISA, 'JSON';
471 my $pkg = 'JSON::Backend::XS::Supportable';
473 *{JSON::new} = sub {
474 my $proto = JSON::XS->new; $$proto = 0;
489 push @{"JSON::XS::Boolean::ISA"}, qw(JSON::PP::Boolean);
490 push @{"JSON::PP::Boolean::ISA"}, qw(JSON::Boolean);
492 $JSON::DEBUG and Carp::carp("set -support_by_pp mode.");
504 package JSON::Backend::XS::Supportable;
506 $Carp::Internal{'JSON::Backend::XS::Supportable'} = 1;
533 JSON::_load_pp( $_INSTALL_ONLY );
536 my $pp = JSON::PP->new;
543 my $unsupported = $type eq 'encode' ? JSON::Backend::XS::UNSUPPORTED_ENCODE_FLAG
544 : JSON::Backend::XS::UNSUPPORTED_DECODE_FLAG;
608 ${$_[0]} &= ~ JSON::Backend::XS::INDENT_LENGTH_FLAG;
610 *JSON::XS::encode = \&JSON::Backend::XS::Supportable::_encode;
622 JSON - JSON (JavaScript Object Notation) encoder/decoder
626 use JSON; # imports encode_json, decode_json, to_json and from_json.
635 $json = JSON->new->allow_nonref;
645 use JSON -support_by_pp;
660 This version is compatible with JSON::XS B<2.34> and later.
665 JSON::PP was earlier included in the C<JSON> distribution, but
667 L<JSON::PP> was removed from the JSON distribution and can now
676 (The newest JSON::PP version still exists in CPAN.)
678 Instead, the C<JSON> distribution will include JSON::backportPP
679 for backwards computability. JSON.pm should thus work as it did
685 * This is 'JSON module version 2' and there are many differences *
691 JSON (JavaScript Object Notation) is a simple data format.
694 This module converts Perl data structures to JSON and vice versa using either
695 L<JSON::XS> or L<JSON::PP>.
697 JSON::XS is the fastest and most proper JSON module on CPAN which must be
699 JSON::PP is a pure-Perl module which is bundled in this distribution and
700 has a strong compatibility to JSON::XS.
702 This module try to use JSON::XS by default and fail to it, use JSON::PP instead.
703 So its features completely depend on JSON::XS or JSON::PP.
707 To distinguish the module name 'JSON' and the format type JSON,
711 Module name : C<JSON>
713 Format type : JSON
726 JSON::XS requires Perl 5.8.2 (but works correctly in 5.8.8 or later), so in older versions
727 C<JSON> should call JSON::PP as the backend which can be used since Perl 5.005.
729 With Perl 5.8.x JSON::PP works, but from 5.8.0 to 5.8.2, because of a Perl side problem,
730 JSON::PP works slower in the versions. And in 5.005, the Unicode handling is not available.
731 See to L<JSON::PP/UNICODE HANDLING ON PERLS> for more information.
733 See also to L<JSON::XS/A FEW NOTES ON UNICODE AND PERL>
734 and L<JSON::XS/ENCODING/CODESET_FLAG_NOTES>.
740 by JSON and Perl, the deserialised data structure is identical on the Perl
746 =item * strict checking of JSON correctness
748 There is no guessing, no generating of illegal JSON texts by default,
749 and only JSON is accepted as input by default (the latter is a security
752 See to L<JSON::XS/FEATURES> and L<JSON::PP/FEATURES>.
756 This module returns a JSON::XS object itself if available.
757 Compared to other JSON modules and other serialisers such as Storable,
758 JSON::XS usually compares favorably in terms of speed, too.
760 If not available, C<JSON> returns a JSON::PP object instead of JSON::XS and
780 Some documents are copied and modified from L<JSON::XS/FUNCTIONAL INTERFACE>.
791 $json_text = JSON->new->utf8->encode($perl_scalar)
798 to parse that as an UTF-8 encoded JSON text, returning the resulting
803 $perl_scalar = JSON->new->utf8->decode($json_text)
814 $json_text = JSON->new->encode($perl_scalar)
826 $json_text = JSON->new->utf8(1)->pretty(1)->encode($perl_scalar)
829 you should use C<encode_json> (supposed that JSON data are encoded in UTF-8).
840 $perl_scalar = JSON->decode($json_text)
852 $perl_scalar = JSON->new->utf8(1)->decode($json_text)
855 you should use C<decode_json> (supposed that JSON data are encoded in UTF-8).
857 =head2 JSON::is_bool
859 $is_boolean = JSON::is_bool($scalar)
861 Returns true if the passed scalar represents either JSON::true or
862 JSON::false, two constants that act like C<1> and C<0> respectively
863 and are also used to represent JSON C<true> and C<false> in Perl strings.
865 =head2 JSON::true
867 Returns JSON true value which is blessed object.
868 It C<isa> JSON::Boolean object.
870 =head2 JSON::false
872 Returns JSON false value which is blessed object.
873 It C<isa> JSON::Boolean object.
875 =head2 JSON::null
879 See L<MAPPING>, below, for more information on how JSON values are mapped to
886 If you know a JSON text from an outer world - a network, a file content, and so on,
887 is encoded in UTF-8, you should use C<decode_json> or C<JSON> module object
891 my $json = JSON->new->utf8;
915 So you B<cannot> use C<decode_json> nor C<JSON> module object with C<utf8> enable.
916 Instead of them, you use C<JSON> module object with C<utf8> disable or C<from_json>.
927 And now, you want to convert your C<$perl_scalar> into JSON data and
931 in UTF-8, you should use C<encode_json> or C<JSON> module object with C<utf8> enable.
940 You B<cannot> use C<encode_json> nor C<JSON> module object with C<utf8> enable.
941 Instead of them, you use C<JSON> module object with C<utf8> disable or C<to_json>.
966 $json = JSON->new
968 Returns a new C<JSON> object inherited from either JSON::XS or JSON::PP
969 that can be used to de/encode JSON strings.
973 The mutators for flags all return the JSON object again and thus calls can
976 my $json = JSON->new->utf8->space_after->encode({a => [1,2]})
990 required by the JSON syntax or other flags. This results in a faster and more compact format.
994 See to L<JSON::PP/UNICODE HANDLING ON PERLS> if the backend is PP.
996 JSON->new->ascii(1)->encode([chr 0x10401])
1005 If $enable is true (or missing), then the encode method will encode the resulting JSON
1009 unless required by the JSON syntax or other flags.
1011 JSON->new->latin1->encode (["\x{89}\x{abc}"]
1020 If $enable is true (or missing), then the encode method will encode the JSON result
1028 If $enable is false, then the encode method will return the JSON string as a (non-encoded)
1033 Example, output UTF-16BE-encoded JSON:
1036 $jsontext = encode "UTF-16BE", JSON::XS->new->encode ($object);
1038 Example, decode UTF-32LE-encoded JSON:
1041 $object = JSON::XS->new->decode (decode "UTF-32LE", $jsontext);
1043 See to L<JSON::PP/UNICODE HANDLING ON PERLS> if the backend is PP.
1058 The indent space length is three and JSON::XS cannot change the indent
1072 resulting JSON text is guaranteed not to contain any C<newlines>.
1074 This setting has no effect when decoding JSON texts.
1077 With JSON::PP, you can also access C<indent_length> to change indent space length.
1087 optional space before the C<:> separating keys from values in JSON objects.
1092 This setting has no effect when decoding JSON texts.
1106 optional space after the C<:> separating keys from values in JSON objects
1113 This setting has no effect when decoding JSON texts.
1127 extensions to normal JSON syntax (see below). C<encode> will not be
1129 JSON texts as if they were valid!>. I suggest only to use this option to
1134 valid JSON texts.
1142 JSON I<separates> array elements and key-value pairs with commas. This
1143 can be annoying if you write JSON texts manually and want to be able to
1158 Whenever JSON allows whitespace, shell-style comments are additionally
1163 1, # this comment not allowed in JSON
1176 If C<$enable> is true (or missing), then the C<encode> method will output JSON objects
1184 the same JSON text (given the same overall settings). If it is disabled,
1188 This setting has no effect when decoding JSON texts.
1197 non-reference into its corresponding string, number or null JSON value,
1198 which is an extension to RFC4627. Likewise, C<decode> will accept those JSON
1202 passed an arrayref or hashref, as JSON texts must either be an object
1204 JSON object or array.
1206 JSON->new->allow_nonref->encode ("Hello, World!")
1216 exception when it encounters values it cannot represent in JSON (for
1217 example, filehandles) but instead will encode a JSON "null" value.
1222 exception when it encounters anything it cannot encode as JSON.
1275 If use C<JSON> with C<-convert_blessed_universally>, the C<UNIVERSAL::TO_JSON>
1287 JSON objects as non-blessed object.
1289 JSON -convert_blessed_universally;
1301 time it decodes a JSON object. The only argument passed to the coderef
1313 Example, convert all JSON objects into the integer 5:
1315 my $js = JSON->new->filter_json_object (sub { 5 });
1328 JSON objects having a single key named C<$key>.
1331 C<filter_json_object>, if any. It gets passed the single value in the JSON
1343 as single-key JSON objects are as close to the type-tagged value concept
1344 as JSON gets (it's basically an ID/VALUE tuple). Of course, JSON does not
1353 Example, decode JSON objects of the form C<< { "__widget__" => <id> } >>
1357 JSON
1384 With JSON::XS, this flag resizes strings generated by either
1386 memory when your JSON texts are either very very long or you have many
1393 With JSON::PP, it is noop about resizing strings but tries
1396 See to L<JSON::XS/OBJECT-ORIENTED INTERFACE> and L<JSON::PP/METHODS>.
1405 or decoding. If a higher nesting level is detected in JSON text or a Perl
1419 crashing. (JSON::XS)
1421 With JSON::PP as the backend, when a large value (100 or more) was set and
1425 See L<JSON::XS/SECURITY CONSIDERATIONS> for more info on why this is useful.
1433 Set the maximum length a JSON text may have (in bytes) where decoding is
1442 See L<JSON::XS/SECURITY CONSIDERATIONS>, below, for more info on why this is useful.
1449 to a hash or array) to its JSON representation. Simple scalars will be
1450 converted into JSON string or number sequences, while references to arrays
1451 become JSON arrays and references to hashes become JSON objects. Undefined
1452 Perl values (e.g. C<undef>) become JSON C<null> values.
1459 The opposite of C<encode>: expects a JSON text and tries to parse it,
1462 JSON numbers and strings become simple Perl scalars. JSON arrays become
1463 Perl arrayrefs and JSON objects become Perl hashrefs. C<true> becomes
1464 C<1> (C<JSON::true>), C<false> becomes C<0> (C<JSON::false>) and
1472 when there is trailing garbage after the first JSON object, it will
1476 JSON->new->decode_prefix ("[1] the tail")
1479 See to L<JSON::XS/OBJECT-ORIENTED INTERFACE>
1508 Most of this section are copied and modified from L<JSON::XS/INCREMENTAL PARSING>.
1510 In some cases, there is the need for incremental parsing of JSON texts.
1511 This module does allow you to parse a JSON stream incrementally.
1512 It does so by accumulating text until it has a full JSON object, which
1514 to see if a full JSON object is available, but is much more efficient
1517 The backend module will only attempt to parse the JSON text once it is sure it
1522 soon as a syntactically valid JSON text has been seen. This means you need
1541 existing JSON fragment stored in the C<$json> object.
1548 exactly I<one> JSON object. If that is successful, it will return this
1556 otherwise. For this to work, there must be no separators between the JSON
1559 case. Note that in this case, any previously-parsed JSON texts will be
1562 Example: Parse some JSON arrays/objects in a given string and return them.
1564 my @objs = JSON->new->incr_parse ("[5][7][1,2]");
1570 This method returns the currently stored JSON fragment as an lvalue, that
1579 JSON object or b) parsing multiple JSON objects separated by non-JSON text
1607 This is useful if you want to repeatedly parse JSON objects and want to
1611 See to L<JSON::XS/INCREMENTAL PARSING> for examples.
1614 =head1 JSON::PP SUPPORT METHODS
1616 The below methods are JSON::PP own methods, so when C<JSON> works
1617 with JSON::PP (i.e. the created object is a JSON::PP object), available.
1618 See to L<JSON::PP/JSON::PP OWN METHODS> in detail.
1620 If you use C<JSON> with additional C<-support_by_pp>, some methods
1621 are available even with JSON::XS. See to L<USE PP FEATURES EVEN THOUGH XS BACKEND>.
1623 BEING { $ENV{PERL_JSON_BACKEND} = 'JSON::XS' }
1625 use JSON -support_by_pp;
1627 my $json = JSON->new;
1637 use JSON -support_by_pp, -no_export;
1645 any JSON strings quoted by single quotations that are invalid JSON
1660 bare keys of JSON object that are invalid JSON format.
1676 objects into JSON numbers with C<allow_blessed> enable.
1683 See to L<MAPPING> about the conversion of JSON number.
1689 The unescaped [\x00-\x1f\x22\x2f\x5c] strings are invalid in JSON strings
1697 See to L<JSON::PP/JSON::PP OWN METHODS>.
1703 According to JSON Grammar, I<slash> (U+002F) is escaped. But by default
1704 JSON backend modules encode strings without escaping slash.
1712 With JSON::XS, The indent space length is 3 and cannot be changed.
1713 With JSON::PP, it sets the indent space length with the given $length.
1723 $js = $pc->sort_by(sub { $JSON::PP::a cmp $JSON::PP::b })->encode($obj);
1729 sub JSON::PP::own_sort { $JSON::PP::a cmp $JSON::PP::b }
1731 As the sorting routine runs in the JSON::PP scope, the given
1733 with 'JSON::PP::'.
1737 See to L<JSON::PP/JSON::PP OWN METHODS>.
1741 This section is copied from JSON::XS and modified to C<JSON>.
1742 JSON::XS and JSON::PP mapping mechanisms are almost equivalent.
1744 See to L<JSON::XS/MAPPING>.
1746 =head2 JSON -> PERL
1752 A JSON object becomes a reference to a hash in Perl. No ordering of object
1753 keys is preserved (JSON does not preserver object key ordering itself).
1757 A JSON array becomes a reference to an array in Perl.
1761 A JSON string becomes a string scalar in Perl - Unicode codepoints in JSON
1767 A JSON number becomes either an integer, numeric (floating point) or
1773 If the number consists of digits only, C<JSON> will try to represent
1777 which case you lose roundtripping ability, as the JSON number will be
1778 re-encoded to a JSON string).
1783 the JSON number will still be re-encoded as a JSON number).
1787 floating point, C<JSON> only guarantees precision up to but not including
1790 If the backend is JSON::PP and C<allow_bignum> is enable, the big integers
1796 These JSON atoms become C<JSON::true> and C<JSON::false>,
1798 C<1> and C<0>. You can check whether a scalar is a JSON boolean by using
1799 the C<JSON::is_bool> function.
1801 If C<JSON::true> and C<JSON::false> are used as strings or compared as strings,
1804 print JSON::true . "\n";
1806 print JSON::true + 1;
1809 ok(JSON::true eq 'true');
1810 ok(JSON::true eq '1');
1811 ok(JSON::true == 1);
1813 C<JSON> will install these missing overloading features to the backend modules.
1818 A JSON null atom becomes C<undef> in Perl.
1820 C<JSON::null> returns C<undef>.
1825 =head2 PERL -> JSON
1827 The mapping from Perl to JSON is slightly more difficult, as Perl is a
1828 truly typeless language, so we can only guess which JSON type is meant by
1835 Perl hash references become JSON objects. As there is no inherent ordering
1836 in hash keys (or JSON objects), they will usually be encoded in a
1838 stays generally the same within a single run of a program. C<JSON>
1840 the same data structure will serialise to the same JSON text (given same
1841 settings and version of JSON::XS), but this incurs a runtime overhead
1842 and is only rarely useful, e.g. when you want to compare some JSON text
1845 In future, the ordered object feature will be added to JSON::PP using C<tie> mechanism.
1850 Perl array references become JSON arrays.
1856 C<1>, which get turned into C<false> and C<true> atoms in JSON. You can
1857 also use C<JSON::false> and C<JSON::true> to improve readability.
1859 to_json [\0,JSON::true] # yields [false,true]
1861 =item JSON::true, JSON::false, JSON::null
1863 These special values become JSON true and JSON false values,
1866 JSON::null returns C<undef>.
1870 Blessed objects are not directly representable in JSON. See the
1878 into JSON members and arrays.
1880 use JSON -convert_blessed_universally;
1881 JSON->new->allow_blessed->convert_blessed->encode( $blessed_object );
1888 difficult objects to encode: JSON::XS and JSON::PP will encode undefined scalars as
1889 JSON C<null> values, scalars that have last been used in a string context
1890 before encoding as JSON strings, and anything else as number value:
1923 infinities or NaN's - these cannot be represented in JSON, and it is an
1928 If the backend is JSON::PP and C<allow_bignum> is enable,
1930 objects into JSON numbers.
1935 =head1 JSON and ECMAscript
1937 See to L<JSON::XS/JSON and ECMAscript>.
1939 =head1 JSON and YAML
1941 JSON is not a subset of YAML.
1942 See to L<JSON::XS/JSON and YAML>.
1947 When you use C<JSON>, C<JSON> tries to C<use> JSON::XS. If this call failed, it will
1948 C<uses> JSON::PP. The required JSON::XS version is I<2.2> or later.
1950 The C<JSON> constructor method returns an object inherited from the backend module,
1951 and JSON::XS object is a blessed scalar reference while JSON::PP is a blessed hash
1957 my $json = JSON->new; # XS or PP?
1962 JSON->backend; # 'JSON::XS' or 'JSON::PP'
1964 JSON->backend->is_pp: # 0 or 1
1966 JSON->backend->is_xs: # 1 or 0
1977 =item PERL_JSON_BACKEND = 0 or PERL_JSON_BACKEND = 'JSON::PP'
1979 Always use JSON::PP
1981 =item PERL_JSON_BACKEND == 1 or PERL_JSON_BACKEND = 'JSON::XS,JSON::PP'
1983 (The default) Use compiled JSON::XS if it is properly compiled & installed,
1984 otherwise use JSON::PP.
1986 =item PERL_JSON_BACKEND == 2 or PERL_JSON_BACKEND = 'JSON::XS'
1988 Always use compiled JSON::XS, die if it isn't properly compiled & installed.
1990 =item PERL_JSON_BACKEND = 'JSON::backportPP'
1992 Always use JSON::backportPP.
1993 JSON::backportPP is JSON::PP back port module.
1994 C<JSON> includes JSON::backportPP instead of JSON::PP.
2002 BEGIN { $ENV{PERL_JSON_BACKEND} = 'JSON::PP' }
2003 use JSON; # always uses JSON::PP
2009 Many methods are available with either JSON::XS or JSON::PP and
2010 when the backend module is JSON::XS, if any JSON::PP specific (i.e. JSON::XS unsupported)
2013 But If you C<use> C<JSON> passing the optional string C<-support_by_pp>,
2015 This feature is achieved by using JSON::PP in C<de/encode>.
2017 BEGIN { $ENV{PERL_JSON_BACKEND} = 2 } # with JSON::XS
2018 use JSON -support_by_pp;
2019 my $json = JSON->new;
2022 At this time, the returned object is a C<JSON::Backend::XS::Supportable>
2023 object (re-blessed XS object), and by checking JSON::XS unsupported flags
2030 C<-support_by_pp> is effective only when the backend module is JSON::XS
2033 See to L<JSON::PP SUPPORT METHODS>.
2038 If you use old C<JSON> 1.xx in your code, please check it.
2054 C<JSON> class variables - C<$JSON::AUTOCONVERT>, C<$JSON::BareKey>, etc...
2059 =item Package JSON::Converter and JSON::Parser are deleted.
2061 Now C<JSON> bundles with JSON::PP which can handle JSON more properly than them.
2063 =item Package JSON::NotString is deleted.
2065 There was C<JSON::NotString> class which represents JSON value C<true>, C<false>, C<null>
2066 and numbers. It was deleted and replaced by C<JSON::Boolean>.
2068 C<JSON::Boolean> represents C<true> and C<false>.
2070 C<JSON::Boolean> does not represent C<null>.
2072 C<JSON::null> returns C<undef>.
2074 C<JSON> makes L<JSON::XS::Boolean> and L<JSON::PP::Boolean> is-a relation
2075 to L<JSON::Boolean>.
2077 =item function JSON::Number is obsoleted.
2079 C<JSON::Number> is now needless because JSON::XS and JSON::PP have
2084 Perl implementation of JSON-RPC protocol - C<JSONRPC >, C<JSONRPC::Transport::HTTP>
2086 Instead of them, there is L<JSON::RPC> which supports JSON-RPC protocol version 1.1.
2093 it is always successful for the below codes even with JSON::XS.
2095 use JSON -support_by_pp;
2114 $JSON::BareKey = 1;
2115 $JSON::QuotApos = 1;
2125 $JSON::BareKey = 1;
2141 $json = JSON->new->pretty;
2143 =item $JSON::Pretty, $JSON::Indent, $JSON::Delimiter
2145 If C<indent> is enable, that means C<$JSON::Pretty> flag set. And
2146 C<$JSON::Delimiter> was substituted by C<space_before> and C<space_after>.
2157 (Only with JSON::PP, if C<-support_by_pp> is not used.)
2161 =item $JSON::BareKey
2163 (Only with JSON::PP, if C<-support_by_pp> is not used.)
2167 =item $JSON::ConvBlessed
2171 =item $JSON::QuotApos
2173 (Only with JSON::PP, if C<-support_by_pp> is not used.)
2177 =item $JSON::SingleQuote
2179 Disable. C<JSON> does not make such a invalid JSON string any longer.
2181 =item $JSON::KeySort
2189 (Only with JSON::PP, even if C<-support_by_pp> is used currently.)
2193 $json->sort_by(sub { $JSON::PP::a <=> $JSON::PP::b })->encode($perl_scalar)
2195 Can't access C<$a> and C<$b> but C<$JSON::PP::a> and C<$JSON::PP::b>.
2197 =item $JSON::SkipInvalid
2201 =item $JSON::AUTOCONVERT
2203 Needless. C<JSON> backend modules have the round-trip integrity.
2205 =item $JSON::UTF8
2207 Needless because C<JSON> (JSON::XS/JSON::PP) sets
2230 See to L<JSON::XS/A FEW NOTES ON UNICODE AND PERL>.
2232 =item $JSON::UnMapping
2236 =item $JSON::SelfConvert
2259 No test with JSON::PP. If with JSON::XS, See to L<JSON::XS/THREADS>.
2264 Please report bugs relevant to C<JSON> to E<lt>makamaka[at]cpan.orgE<gt>.
2269 Most of the document is copied and modified from JSON::XS doc.
2271 L<JSON::XS>, L<JSON::PP>
2279 JSON::XS was written by Marc Lehmann <schmorp[at]schmorp.de>