Skip Menu |

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

Report information
The Basics
Id: 98508
Status: new
Priority: 0/
Queue: JSON-DWIW

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

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



Subject: Support RFC7159: Values as top-level entities.
RFC7159 puts "values" at the top level of the grammar, and values can be objects, arrays, strings, numbers, "null", "true", and "false". Examples: my $jn = JSON::DWIW->to_json(1); # 1 my $js = JSON::DWIW->to_json("Hello world"); # "Hello world" my $string = JSON::DWIW->from_json('"Hello world"'); # Hello world my $number = JSON::DWIW->from_json('1'); # 1 Also worth mentioning: ECMA-404 also supports the notion of a 'value' being the top level, where a value can be those things described above: (object, array, string, etc.). Current state of affairs: Python (2.7/3) support this aspect of RFC7159, though the documentation has not been updated to mention this. Ruby does not yet, though a ticket has been opened and taken. On CPAN, Mojo::JSON and its fork, JSON::Tiny do support. The JSON.pm / JSON::* family do support as an accidental feature: the "allow_nonref" configuration option allows for "values" as top level entities, including numbers/strings, etc. But this support for RFC7159 is really just a coincidence; it's not intentional (yet).