Re: [Json] Human JSON (Hjson)

Christian Zangl <coralllama@gmail.com> Wed, 25 May 2016 08:36 UTC

Return-Path: <coralllama@gmail.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 6B3A712D12C for <json@ietfa.amsl.com>; Wed, 25 May 2016 01:36:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Level:
X-Spam-Status: No, score=-2.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DP99AHxf2kvs for <json@ietfa.amsl.com>; Wed, 25 May 2016 01:36:56 -0700 (PDT)
Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 21A1412D10C for <json@ietf.org>; Wed, 25 May 2016 01:36:55 -0700 (PDT)
Received: by mail-wm0-x230.google.com with SMTP id n129so168965377wmn.1 for <json@ietf.org>; Wed, 25 May 2016 01:36:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=ooBHtbh9f3TExa0YCE6x6gasI62y7v0ZQP+ObngA3ak=; b=SGUyKsJC9q+0BngUUFcNlpafHg9GsYftjx2goSyyyTbMn3gA6+xTr99v+sU0mEl79D U2dkXfA5SXZbHudsZ0kb8CxZj/8Px7VUCcj1Vccx1Lwwg1Fu90o1DEJmfX9pTRkw2pME pACRQDF4j8M9OWIrsaJamcqwzHOVBxC/7fvAx8OmLOdeXr4GAINP9v/3z/SwBqvTai7p /4utoHTFxPHDK2YrLjQrXVpOaNCQPs5HgW9NQivRnoMmamiBN1shkkcugvwGqYl8JHA9 2PR3KN8vyTiZhw2iBgVZXoK13G+xJJDuK6qvsdy/29UBtxuTHEr+BTl1ybcb/4+8WY/d LitQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ooBHtbh9f3TExa0YCE6x6gasI62y7v0ZQP+ObngA3ak=; b=dtztvXg1O+ixeKMnRiQw6Euk2I9VZExPHYkfj16IQ700wzJRLLl2Xqp669mVJCac+J smSpmjd3NZb2D460eyDzM28q1EXoObx24Tq7w20yxx24zIuro1c+ZFWhQgCEOkwkMVSY Y0qTpdjRFApq2IbIO8jxrGN8NrdjoHO65cL5y2q9VY1w1mN/udjSY+Xcdc2zWOOemHBd rRfOYecB1aR3Rp8RRIhGqgkaAsAzruNKzxS8H+NUU+cSLeL0u/EW0lA0xjXjzWxOnM9q Tp20wGdFfC8ieJek8zgRWxm+Cui8FhkRiHFTQ5adtFgdeI7kx4J3uA3XUdGS0E+0S8pq AKWA==
X-Gm-Message-State: ALyK8tImSCLcn+VvZsxJHDtb+QkQfJAg39VDyvTP1tuQrexnnYA2zUlVvYL98Ts6O7mVXQ==
X-Received: by 10.28.137.14 with SMTP id l14mr2016962wmd.64.1464165414180; Wed, 25 May 2016 01:36:54 -0700 (PDT)
Received: from [192.168.1.181] (178.113.72.111.wireless.dyn.drei.com. [178.113.72.111]) by smtp.googlemail.com with ESMTPSA id f11sm23595609wmf.22.2016.05.25.01.36.52 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 May 2016 01:36:53 -0700 (PDT)
To: Sean Leonard <dev+ietf@seantek.com>, json@ietf.org
References: <9ec25767-7471-2ca3-ded5-afed67863742@gmail.com> <07aea2e2-a675-797b-eab6-7cd7ccc5d2d1@seantek.com>
From: Christian Zangl <coralllama@gmail.com>
Message-ID: <21160816-48c7-169e-5a83-19b7601420a0@gmail.com>
Date: Wed, 25 May 2016 10:36:51 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.0
MIME-Version: 1.0
In-Reply-To: <07aea2e2-a675-797b-eab6-7cd7ccc5d2d1@seantek.com>
Content-Type: text/plain; charset="windows-1252"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/FxKIQL8RY8zSw1CQ7CCy9fZAxD8>
Subject: Re: [Json] Human JSON (Hjson)
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
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: <https://mailarchive.ietf.org/arch/browse/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: Wed, 25 May 2016 08:36:58 -0000

On 2016-05-25 08:48, Sean Leonard wrote:
> It seems that what you want is a configuration file format. There are
> already many config file formats, as well as many textual data formats.
> YAML comes to mind. This looks like YAML (certainly, a subset of it) a
> lot more than JSON or even JavaScript.

Yes this is another config file format. Why? Because I think that using 
JSON for configs is an antipattern. Since YAML&others are not a good 
option (to some people) Hjson is positioned as a reasonable alternative.

> Why not just embed completely valid JSON items in the configuration file
> format of your choice? That seems a lot more practical. Configuration
> files usually say "name=value" anyway, not "name: value".

I'm not sure what you mean here. If I embed JSON in the config I have 
the same problems as using JSON for configs in the first place.

> # is not comment syntax in JSON, or JavaScript. It's from config files
> and scripts. Hence demonstrating that this is not really JSON-related.

JSON was 'discovered' in JavaScript, hence it's name, but has since been 
ported to 50+ languages. While JavaScript is evolving, JSON is fixed at 
v1 (not a bad thing). So to me, apart from the name, JSON isn't 
JavaScript anymore.

JSON doesn't allow comments so selecting # seemed practical (IMO it's 
nicer to read than //). // and /**/ comments were added because it was a 
popular request.

> You say "omit braces for the root object", but then it's not JSON. If
> you include the braces, then it's JSON, and it's annoying for humans to
> write. Humans are lazy and don't like to balance < > tags or { } braces.
> They like line breaks by hitting Enter to separate things. But line
> breaks are not separators in JSON/JavaScript. JSON/JS are designed to
> let the author put in line breaks wherever he/she/it wants, to aesthetic
> taste. And vice-versa for commas. It's easy to balance { } braces when
> you just have a couple of them, i.e., a simple JSON object that is the
> single value of a single config element on a single line.

Hjson is a superset of JSON. You don't have to omit them but they are 
optional for the root.

You need something to define the structure. Braces are there because 
JSON has them and because the alternatives (like indentation) seem worse.

Hjson allows line breaks to be separators instead of commas.

> Your format should not get a media type. If it is for "humans", it needs
> to be text/*, such as text/plain. Humans edit things with editors, that
> work on text. As text, you cannot assume UTF-8 encoding. It's just a
> stream of text. If a user chooses to author this format in Shift-JIS (or
> if that's the locale/code page in effect on the local machine), that's
> the user's choice. You cannot ignore the implications of the charset
> parameter.

I can remove the media type but wouldn't it help with file 
associations/editor syntax?

Joe suggested to require UTF-8, it made sense to me. 
https://github.com/laktak/hjson/issues/43

> Finally, since the draft explicitly disavows use in transfer protocols
> and so forth, it's not appropriate for Standards Track. I'd suggest
> Experimental.

OK. Thanks for the feedback!