Re: [Json] Comments by convention

Douglas Crockford <douglas@crockford.com> Fri, 07 June 2013 16:56 UTC

Return-Path: <douglas@crockford.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 425B221F92E3 for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 09:56:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.539
X-Spam-Level:
X-Spam-Status: No, score=-2.539 tagged_above=-999 required=5 tests=[AWL=0.060, BAYES_00=-2.599]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WpfOaoenOrrP for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 09:56:11 -0700 (PDT)
Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) by ietfa.amsl.com (Postfix) with ESMTP id 5B08821F9079 for <json@ietf.org>; Fri, 7 Jun 2013 09:56:11 -0700 (PDT)
Received: from [192.168.114.223] ([216.113.168.135]) by mrelay.perfora.net (node=mrus4) with ESMTP (Nemesis) id 0LsCqF-1UNsgz0rjr-013CdR; Fri, 07 Jun 2013 12:56:08 -0400
Message-ID: <51B2109A.30506@crockford.com>
Date: Fri, 07 Jun 2013 09:55:54 -0700
From: Douglas Crockford <douglas@crockford.com>
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
MIME-Version: 1.0
To: Pete Cordell <petejson@codalogic.com>, "json@ietf.org" <json@ietf.org>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:M6i6YCClH9HUFTdYR6a02JNBnGn0uJAQTfhFjqG37Pe aC7BMWoQh+v/yCJf6K+Dd8gyuYxvZ9jEXef/fzocUpSRAPQt3W prVNjwWYRt+jQ8zSTkznWj+hSPSKXidwuo9z3YpXIUHnCJeWSf 8Cjx9IxGqvzDjP6fVj7obXWgpE3x3EYqW51K3sN71jFU0j1Yvp lFzA6uRo5Q2Mcv7ZoiwQn99iPEL6RRrBiLVeu+70vp8LCw3Ikb fhTZav0U6NNJ7NZkzKRKbsAPdpOBA1YEyFuT1JrQuqQVNB9hfH gI6iYPEZvfbSCH6emPRikq+ISvCUYm8XhBv5wviJ1EW/jr7Oeo yI50XQLZqti2K8oWKkvU=
Subject: Re: [Json] Comments by convention
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Jun 2013 16:56:17 -0000

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.