From: Brian Mitchell Date: 2009-09-30T03:54:20+09:00 Subject: [ruby-core:25861] Re: [Bug #2160] JSON can't parse input where top-level object is a string On Tue, Sep 29, 2009 at 14:44, gus wrote: > On 9/29/09 2:14 PM, "Caleb Clausen" wrote: > >> Tim Bray wrote: >>> Per RFC4267, http://www.ietf.org/rfc/rfc4627.txt, "foo" isn't legal JSON. >>> Top level has to be an object {} or array []. �So unparse should refuse to >>> process "foo". �This isn't just a theoretical standards-wonk problem, I got >>> bitten trying to interop with Java JSON libraries on this one. >> >> Do you (or anyone else) have any idea why it was specified this way? It >> seems kind of inconvenient. > > It is meant to be a subset of JavaScript and has to conform to the > JavaScript spec. I believe it is valid to have a free standing string literal in JavaScript actually. Brian.