Aaron D. Gifford wrote:
> Thanks for the note, Brian.
> 
> The JSON documentation does NOT make that clear.

I could understand if it only allowed an object at the top level (which 
is what CouchDB requires), but I agree it doesn't make sense to allow 
two types of values but not the other types.

Your kludge is a bit messy, it won't parse ' "foo"' for example (with a 
leading space). If you are afraid of building an extra string, then how 
about:

def jparse(str)
  return JSON.parse(str) if str =~ /\A\s*[{\[]/
  JSON.parse("[#{str}]")[0]
end
-- 
Posted via http://www.ruby-forum.com/.