JSON::PP - An experimental JSON::XS compatible Pure Perl module. use JSON::PP; $obj = from_json($json_text); $json_text = to_json($obj); # or $obj = jsonToObj($json_text); $json_text = objToJson($obj); $json = new JSON; $json_text = $json->ascii->pretty($obj); # you can set options to functions. $json_text = to_json($obj, {ascii => 1, intend => 2}); $obj = from_json($json_text, {utf8 => 0}); This module is JSON::XS compatible Pure Perl module. ( Perl better than 5.008 is recommended) Module variables ($JSON::*) were abolished. JSON::PP will be renamed JSON (JSON-2.0). Many things including error handling are learned from JSON::XS. For t/02_error.t compatible, error messages was copied partially from JSON::XS.

FEATURES
This module knows how to handle Unicode (perhaps), but not yet documents how and when it does so. In Perl5.6x, Unicode handling requires Unicode::String module. Perl 5.005_xx, Unicode handling is disable currenlty. This module solved the problem pointed out by JSON::XS using B module. I want to bring close to XS. How do you want to carry out? you can set "strict" decoding method. Compared to other JSON modules, this module does not compare favourably in terms of speed. Very slowly! This module became very simple. Since its interface were anyway made the same as JSON::XS. See to JSON::XS. See to JSON::XS. "objToJson" is an alias. See to JSON::XS. "jsonToObj" is an alias. Returns JSON true value which is blessed object. It "isa" JSON::Literal object. Returns JSON false value which is blessed object. It "isa" JSON::Literal object. Returns JSON null value which is blessed object. It "isa" JSON::Literal object. Returns JSON::PP object. See to JSON::XS. In Perl 5.6, this method requires Unicode::String. If you don't have Unicode::String, the method is always set to false and warns. In Perl 5.005, this option is currently disable. See to JSON::XS. In Perl 5.6, this method requires Unicode::String. If you don't have Unicode::String, the method is always set to false and warns. In Perl 5.005, this option is currently disable. See to JSON::XS. Currently this module always handles UTF-16 as UTF-16BE. See to JSON::XS. See to JSON::XS. Strictly, this module does not carry out equivalent to XS. $json->indent(4); is not the same as this: $json->indent(); See to JSON::XS. See JSON::XS. See to JSON::XS. Strictly, this module does not carry out equivalent to XS. This method can take a subref for sorting (see to JSON). See to JSON::XS. Not yet implemented. See to JSON::XS. Strictly, this module does not carry out equivalent to XS. By default, not 512 (JSON::XS) but 32. See to JSON::XS. See to JSON::XS. In Perl 5.6, if you don't have Unicode::String, the method can't handle UTF-16(BE) char and returns as is. Accessor. $json->property(utf8 => 1); # $json->utf8(1); $value = $json->property('utf8'); # returns 1. See "BLESSED OBJECT" in JSON's self convert function. If this option is set, UTF8 flag in strings generated by "encode"/"decode" is off. Enable. This option will be obsoleted. Allows to decode single quoted strings. Unlike JSON module, this module does not encode Perl string into single quoted string any longer. Allows to decode bare key of member. When json text has any integer in decoding more than Perl can't handle, If this option is on, they are converted into Math::BigInt objects. For JSON format, unescaped [\x00-\x1f\x22\x2f\x5c] strings are invalid and JSON::XS decodes just like that. While this module can deocde thoese. But if this option is set, the module strictly decodes. By default, JSON::PP encodes strings without escaping slash (U+002F). Setting the option to escape slash. Using a benchmark program in the JSON::XS (v1.11) distribution. module | encode | decode | -----------|------------|------------| JSON::PP | 11092.260 | 4482.033 | -----------+------------+------------+ JSON::XS | 341513.380 | 226138.509 | -----------+------------+------------+ In case t/12_binary.t (JSON::XS distribution). (shrink of JSON::PP has no effect.) JSON::PP takes 147 (sec). JSON::XS takes 4. It is troublesome. Under the cleaning. JSON, JSON::XS RFC4627 Makamaka Hannyaharamitu, <makamaka[at]cpan.org> Copyright 2007 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.