W3C home > Mailing lists > Public > public-rdf-wg@w3.org > March 2011

Re: [JSON] comments?

From: Peter Frederick Patel-Schneider <pfps@research.bell-labs.com>
Date: Fri, 25 Mar 2011 10:14:59 -0400
Message-ID: <20110325.101459.1015077919010572588.pfps@research.bell-labs.com>
To: <tomac@google.com>
CC: <public-rdf-wg@w3.org>
From: Thomas Steiner <tomac@google.com>
Subject: Re: [JSON] comments?
Date: Fri, 25 Mar 2011 08:57:25 -0500

> Hi Peter,
> 
>> Is it true that JSON doesn't have any commenting mechanism?
>
> Yes. Some use fake inline comments (counts as pure data):
> 
> {
>   "actualData": {...}
>   "comment": "This is a comment."
> }
> 
> ...others (e.g., the New York Times JSON) (illegally) use:
> 
> /* This is a comment. */
> {
>   "actualData": {...}
> }
> 
> This approach works when the data is eval'ed in JavaScript (evil,
> don't!), but it is definitively illegal JSON.

I find the first more evil.

> Missing comments is definitively a weak spot when JSON is used for,
> e.g., config files. It was not design to be used in that way, though.

Umm, just what was JSON designed for?  

I would think that "[JSON] is easy for humans to read and write" (from
http://json.org) would strongly support the inclusion of comments.

> Hope this helps?!

Indeed it does, and I notice that all three syntaxes appear to not allow
comments.  

> Cheers,
> Tom

I must admit to being surprised, so suprised that it has taken a couple
of days to notice the lack of comments.

peter
Received on Friday, 25 March 2011 14:15:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:04:04 UTC