Skip Menu |

This queue is for tickets about the JSON-PC CPAN distribution.

Report information
The Basics
Id: 20911
Status: resolved
Priority: 0/
Queue: JSON-PC

People
Owner: Nobody in particular
Requestors: jmcnamara [...] cpan.org
Cc:
AdminCc:

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



Subject: JSON::PC Incorrect conversion of strings that look like octal numbers
Hi, JSON::PC doesn't seem to convert quoted values that look like octal numbers correctly. For example: [ { 'phone-number' => '02346' } ] is converted to: [{"phone-number":02346}] If this is reparsed we don't get back the original structure. Instead we get this: [{'phone-number' => 1254}] Here is a full example that compares the output from JSON::PC with the output of JSON: #!/usr/bin/perl -l use strict; use JSON; use JSON::PC; use Data::Dumper; local $Data::Dumper::Terse = 1; local $Data::Dumper::Indent = 0; my $json = JSON->new(); my $json_pc = JSON::PC->new(); my $obj = [ { 'phone-number' => '02346' } ]; my $json_str = $json ->objToJson($obj); my $json_str_pc = $json_pc->objToJson($obj); my $perl_str = $json ->jsonToObj($json_str); my $perl_str_pc = $json_pc->jsonToObj($json_str_pc); print "JSON version : ", $json->VERSION(); print "JSON::PC version : ", $json_pc->VERSION(), "\n"; print "JSON structure : ", $json_str; print "JSON structure PC: ", $json_str_pc, "\n"; print "Perl structure : ", Dumper $perl_str; print "Perl structure PC: ", Dumper $perl_str_pc; __END__ Prints: JSON version : 1.07 JSON::PC version : 0.01 JSON structure : [{"phone-number":"02346"}] JSON structure PC: [{"phone-number":02346}] Perl structure : [{'phone-number' => '02346'}] Perl structure PC: [{'phone-number' => 1254}] JSON::Syck also corresponds to the output of JSON. Tested with Perl 5.8.7 on linux. John. --
From: MAKAMAKA [...] cpan.org
On 水曜日 8月 09 11:01:28 2006, JMCNAMARA wrote: Show quoted text
> Hi, > > JSON::PC doesn't seem to convert quoted values that look like octal > numbers correctly. For example:
Thanks the report. Since JSON::XS released, I plan to discard this module. But I am sorry to have not replied for a long time and not utilize your report effectively. Regards,