Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading JSON::XS before Cpanel breaks round-tripping #18

Closed
clintongormley opened this issue Apr 19, 2014 · 3 comments
Closed

Loading JSON::XS before Cpanel breaks round-tripping #18

clintongormley opened this issue Apr 19, 2014 · 3 comments

Comments

@clintongormley
Copy link

use JSON::XS;
use Cpanel::JSON::XS;

my $json = Cpanel::JSON::XS->new->utf8;

my $json_str = '{"foo": true}';

my $hash = $json->decode($json_str);
$json->pretty;
print $json->encode($hash);

throws:

encountered object 'Types::Serialiser=HASH(0x7fc904804738)', but neither allow_blessed nor convert_blessed settings are enabled at test.pl line 10.
@rurban
Copy link
Owner

rurban commented Apr 19, 2014

technically booleans are now objects. but yes, this limitation should be dropped for those objects, as it should be transparent as before.

@rurban
Copy link
Owner

rurban commented Apr 21, 2014

I've made a mistake in 3.0102. The new JSON-XS-3.x booleans are now blessed to Types::Serialiser::Boolean. Check for this in the XS code also. That's why it threw the allow_blessed error. Will be fixed in the new 3.0103

rurban pushed a commit that referenced this issue Apr 21, 2014
 - Change booleans interop logic (again) for JSON-XS-3.01
   Check now for Types::Serialiser::Boolean refs (#18 clintongormley)
   to avoid allow_blessed for JSON-XS-3.01 booleans.
- add t/52_object.t from JSON::XS
- add .gitignore
@rurban
Copy link
Owner

rurban commented Apr 21, 2014

Fixed with 3.0103: backport allow_tags, decode_tag, FREEZE/THAW callbacks from JSON-XS-3.01
also on cpan

@rurban rurban closed this as completed Apr 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants