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

Re: [JSON] comments?

From: Thomas Steiner <tomac@google.com>
Date: Fri, 25 Mar 2011 14:57:25 +0100
Message-ID: <AANLkTimoUnu1Y1sCZS8JaKbw=u3=_g6zrPyVdux+w99W@mail.gmail.com>
To: Peter Frederick Patel-Schneider <pfps@research.bell-labs.com>
Cc: RDF WG <public-rdf-wg@w3.org>
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.

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.

Hope this helps?!


Thomas Steiner, Research Scientist, Google Inc.
http://blog.tomayac.com, http://twitter.com/tomayac
Received on Friday, 25 March 2011 13:58:33 UTC

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