Skip Menu |

This queue is for tickets about the JSON CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: hg [...] apteryx.fr
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.07
Fixed in: (no value)



Subject: JSON::true and JSON::false cannot be encoded
Hi, $json->encode([ JSON::true ]); sends : encountered object 'true', but neither allow_blessed nor convert_blessed settings are enabled even though $json->allow_blessed is called (which should not be necessary anyway IMO).
From: hg [...] apteryx.fr
Le Mer. Mar. 19 18:37:24 2008, hg@apteryx.fr a écrit : Show quoted text
> Hi, > > $json->encode([ JSON::true ]); > > sends : > > encountered object 'true', but neither allow_blessed nor convert_blessed > settings are enabled > > even though $json->allow_blessed is called > (which should not be necessary anyway IMO).
Sorry, I meant convert_blessed were called
From: makamaka [...] cpan.org
I tried to write the code, but correctly works: BEGIN { $ENV{PERL_JSON_BACKEND} = 0; } # tried with 1 use JSON; my $json = new JSON; print $json->encode([ JSON::true ]); # => [true] Please show me the whole source.
From: hg [...] apteryx.fr
Le Mer. Mar. 19 21:44:44 2008, MAKAMAKA a écrit : Show quoted text
> I tried to write the code, but correctly works: > > BEGIN { $ENV{PERL_JSON_BACKEND} = 0; } # tried with 1 > use JSON; > my $json = new JSON; > print $json->encode([ JSON::true ]); > # => [true] > > Please show me the whole source. >
Hmm. This is a bit more complicated, and somehow linked to the allow_barekey option : use JSON -support_by_pp; $json = JSON->new->allow_barekey; print $json->encode([ JSON::true ]),"\n";
Ok, I understood. This problem is caused by the support_by_pp mode and the real using PP-supported flag. Patch: diff lib\JSON.pm.org lib\JSON.pm 426a427,428 Show quoted text
> push @{"JSON::XS::Boolean::ISA"}, qw(JSON::PP::Boolean);
I will release the fixed version as soon as possible. Thanks,
I released the new vesion 2.08 resolving the problem. Thanks,