- DESIGN CONSIDERATION
- SEE ALSO
- COPYRIGHT AND LICENSE
JSON::XS::ByteString - A more predictable and convenient XS implementation for JSON
use JSON::XS::ByteString qw(encode_json encode_json_unblessed decode_json decode_json_safe); $json_string = encode_json($perl_data); $perl_data = decode_json($json_string); $json_string = encode_json_unblessed($perl_data); # the same behavior as encode_json # but encode blessed references as reference strings, # like 'Object=HASH(0xffffffff)'
This module is a XS implementation for JSON. It provide a more predictable behavior than JSON::XS by always producing strings in JSON for normal scalars. And you can force it to produce numbers in JSON by putting references to numbers.
All the string data are treated as UTF-8 octets and just copy them in and out directly, except
\ and characters that
ord($char) < 32
decode_json won't die with invalid json string.
Because in the pure Perl world, there's insignificant difference between numeric or string. So I think we don't need to do it since the result will be used in Perl.
json_decode preserve the identical structure as it received.
Get a JSON string from a perl data structure. Treat blessed objects as normal references.
Get a JSON string from a perl data structure. Treat blessed objects as strings (such as 'Object=HASH(0xffffffff)')
Get the perl data structure back from a JSON string.
If the given string is not a valid JSON string, it will return a partial data without exceptions right before it encountered the unrecognized character.
The same as
This function is only for compatible with older versions.
This mod's github repository https://github.com/CindyLinz/Perl-JSON-XS-ByteString
Cindy Wang (CindyLinz)
Copyright (C) 2014-2017 by Cindy Wang (CindyLinz)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8 or, at your option, any later version of Perl 5 you may have available.