Skip Menu |

This queue is for tickets about the JSON CPAN distribution.

Report information
The Basics
Id: 40270
Status: resolved
Priority: 0/
Queue: JSON

People
Owner: Nobody in particular
Requestors: wdhawes [...] gmail.com (daily)
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.12
Fixed in: (no value)



Subject: decode() behaviour not as documented for true/false
http://search.cpan.org/~makamaka/JSON-2.12/lib/JSON.pm#decode says: "true becomes 1, false becomes 0 and null becomes undef" But: $ perl -MJSON -MData::Dumper -e 'print Dumper from_json("{ \"arg\": true }")' $VAR1 = { 'arg' => bless( do{\(my $o = 1)}, 'JSON::XS::Boolean' ) }; The behaviour/docs for JSON::XS are the same. From the above documentation snippet, I would have expected { arg => 1 } here, which is what I get using JSON::Syck.
JSON true and false are decoded to blessed scalar reference. Please check http://search.cpan.org/~makamaka/JSON-2.12/lib/JSON.pm#JSON_-%3E_PERL The document about decode will be modified in future. Thanks,
Documented in 2.13.