help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hack for JSON sequences with trailing commas?


From: Barry Margolin
Subject: Re: Hack for JSON sequences with trailing commas?
Date: Thu, 02 Aug 2018 18:42:37 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.4559.1533134429.1292.help-gnu-emacs@gnu.org>,
 Drew Adams <drew.adams@oracle.com> wrote:

> > JSON is a very limited subset of Javascript notation for literals. Many
> > things that are allowed in Javascript source code are not allowed in
> > JSON. The reason is presumably to simplify the design of JSON parsers --
> > they don't have to deal with all possible input formats.
> 
> Yes, but there is a difference between JSON as defined by its standard
> and JSON as it is used in practice in many situations. The former is more
> strict than the latter.
> 
> Here is one description of possible differences between the strict syntax
> of the standard and a lax syntax (one that does allow an extra, final comma):
> 
> https://docs.oracle.com/en/database/oracle/oracle-database/18/adjsn/conditions
> -is-json-and-is-not-json.html#GUID-1B6CFFBE-85FE-41DD-BA14-DD1DE73EAB20

I think Oracle is unusual in being so permissive. I don't think the JSON 
parsers in PHP, Python, or Javascript allow as much as Oracle does.

I think the only common extension to JSON that was commonly allowed was 
allowing the top-level value to be something other than an object or 
array. The JSON spec was recently updated to legitimize this.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]