Subject: bug#46486: 28.0.50; json-parse-string missing support for key-less json strings

From: Philipp <[email-masked]>
Date: Sat, 13 Feb 2021 13:33:26 +0100

> Am 13.02.2021 um 13:24 schrieb Philipp <[email-masked]>:
> 
> 
> 
>> Am 13.02.2021 um 13:04 schrieb Thomas Hisch <[email-masked]>:
>> 
>> 
>> (json-parse-string "\"abc\"")
>> -> progn: could not parse JSON stream: "'[' or '{' expected near '\"abc\"'", "<string>", 1, 5, 5
>> 
>> Note that strings that neither start with [ nor { are valid JSON objects
>> according to the JSON schema.
>> 
> 
> That contradicts RFC 4627, which states: "A JSON text is a serialized object or array.“
> 

OTOH, RFC 8259 does seem to allow any value type at the toplevel now, so we might as well support this.  I don’t have a strong opinion here.  Using RFC 4627 semantics seems a bit safer and more conservative, but given that it’s considered obsoleted by RFC 8259, maybe we should switch to the semantics of the newer standard.