timo / json_fast

a naive imperative json parser in perl6, to evaluate performance against JSON::Tiny
Artistic License 2.0
27 stars 20 forks source link

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

Closed zoffixznet closed 7 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::Fast -e 'say from-json "42"'
a JSON string ought to be a list or an object
  in sub from-json at /home/zoffix/.rakudobrew/moar-nom/install/share/perl6/site/sources/2989569D47BA7B99ACBF76A588A4EE68EB30E3EB line 304
  in block <unit> at -e line 1
timo commented 7 years ago

i just fixed this in f10ae735356899c59bab197b01b30403d5fdbefd