moritz / json

A tiny JSON parser and emitter for Perl 6 on Rakudo
A JSON parser and emitter for Perl 6 on Rakudo
76 stars 16 forks source link

to-json() doesn't comply with newest JSON spec #22

Closed zoffixznet closed 8 years ago

zoffixznet commented 8 years ago

The newest JSON spec—contrary to previous versions—does allow non-object/array things at the top level. Reference: http://rfc7159.net/rfc7159#rfc.section.2 (second paragraph, especially). This module's from-json, however, displays an error when attempting to decode JSON conforming to this newest spec:

$ perl6 -MJSON::Tiny -e 'say from-json "42"'
Input (2 characters) is not a valid JSON string
  in sub from-json at /home/zoffix/.rakudobrew/moar-nom/install/share/perl6/site/sources/411712BEEA6ABF6E99725E6A8837298C923B325F line 59
  in block <unit> at -e line 1