Subject: Re: [Json] Comments by convention

From: Douglas Crockford <[email-masked]>
Date: Fri, 07 Jun 2013 09:55:54 -0700

On 6/7/2013 9:31 AM, Pete Cordell wrote:
> I along with many wish JSON included comments.  Since they can't 
> retrospectively be added, what are the prospects of documenting a 
> convention for including comments in a JSON message?
>
> For example, something along the lines of:
>
> 2.6 Comments
>
> JSON has no native ability to represent comments.  Instead, by 
> convention, unless overridden by a protocol definition, comments can 
> be represented by name/value pairs (a.k.a. members) with string values 
> of the form:
>
>    "//": "This is a comment"
>
> Comments can be associated with a particular member within an object 
> using a comment name of the form "// foo" where "foo" is the name of 
> the member to which the comment applies.
>
> For example:
>
>    "order": {
>            "//": "An order item",
>            "// description": "A short description of the item ordered",
>            "description": "1TB HDD",
>            "// price": "The price in USD",
>            "price": 123.45 }
>
> How much goes up in smoke if we do that? 
That belongs in the best practices document.

---

From: Matthew Morley <[email-masked]>
Date: Fri, 7 Jun 2013 13:21:55 -0400

On Fri, Jun 7, 2013 at 12:55 PM, Douglas Crockford <[email-masked]>wrote:

>> convention, unless overridden by a protocol definition, comments can be
>> represented by name/value pairs (a.k.a. members) with string values of the
>> form:
>>
>> using a comment name of the form "// foo" where "foo" is the name of the
>> member to which the comment applies.
>>
>> For example:
>>
>>    "order": {
>>            "//": "An order item",

+1

-- 
Matthew P. C. Morley

---

From: "Pete Cordell" <[email-masked]>
Date: Fri, 7 Jun 2013 19:41:11 +0100

Original Message From: "Douglas Crockford" 
> That belongs in the best practices document.

OK.  I'll try to remember to shake the tree then.

Pete Cordell
Codalogic Ltd