-
Notifications
You must be signed in to change notification settings - Fork 363
Description
$ ruby191 -v -rjson -e 'p JSON.parse JSON.unparse "foobar"'
'
ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux]
json/common.rb:274: warning: method redefined; discarding old recurse_proc
json/common.rb:122:inparse': 574: unexpected token at '"foobar"' (JSON::ParserError) from json/common.rb:122:inparse'
from -e:1:in `$ ruby -v -rjson -e 'p JSON.parse JSON.unparse "foobar"'
'
ruby 1.9.2dev (2009-09-28 trunk 25126) [i686-linux]
json/common.rb:273: warning: method redefined; discarding old recurse_proc
json/common.rb:122:inparse': 618: unexpected token at '"foobar"' (JSON::ParserError) from json/common.rb:122:inparse'
from -e:1:in `
Original post is [ruby-core:25829] string objects don't survive round-trip in yaml&json.
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/25829
RFC4627 doesn't allow such JSON, so I think JSON.unparse shouldn't return such JSON.
http://www.ietf.org/rfc/rfc4627.txt