Re: [Json] Human JSON (Hjson)

Sean Leonard <dev+ietf@seantek.com> Wed, 25 May 2016 06:49 UTC

Return-Path: <dev+ietf@seantek.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 E64CB12D5BF for <json@ietfa.amsl.com>; Tue, 24 May 2016 23:49:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.602
X-Spam-Level:
X-Spam-Status: No, score=-2.602 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001] autolearn=ham autolearn_force=no
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 JRLrPwQE0jKA for <json@ietfa.amsl.com>; Tue, 24 May 2016 23:49:19 -0700 (PDT)
Received: from mxout-08.mxes.net (mxout-08.mxes.net [216.86.168.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9B8B812DA5C for <json@ietf.org>; Tue, 24 May 2016 23:49:18 -0700 (PDT)
Received: from [192.168.123.7] (unknown [75.83.2.34]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 5D8FA509B5; Wed, 25 May 2016 02:49:17 -0400 (EDT)
To: json@ietf.org, Christian Zangl <coralllama@gmail.com>
References: <9ec25767-7471-2ca3-ded5-afed67863742@gmail.com>
From: Sean Leonard <dev+ietf@seantek.com>
Message-ID: <07aea2e2-a675-797b-eab6-7cd7ccc5d2d1@seantek.com>
Date: Tue, 24 May 2016 23:48:02 -0700
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0
MIME-Version: 1.0
In-Reply-To: <9ec25767-7471-2ca3-ded5-afed67863742@gmail.com>
Content-Type: text/plain; charset="windows-1252"; format="flowed"
Content-Transfer-Encoding: quoted-printable
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/6YrabL79n3F9V4QX9yur8BnsqYM>
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 06:49:25 -0000

On 5/24/2016 2:36 PM, Christian Zangl wrote:
> JSON is used in a lot of places and has helped improve things like 
> data exchange and data storage. It is also used in areas it's less 
> suited for, like configuration files. People seem to prefer JSON for 
> configuration over YAML and other config formats.
>
> I started Human JSON (Hjson) because I found the experience 
> frustrating (for example missing/trailing comma problems, no 
> comments). With Hjson you get a superset of JSON that allows you to
>
> - add #, // or /**/ comments,
> - omit quotes for keys,
> - omit quotes for strings (terminated by LF, no escapes),
> - omit braces for the root object,
> - omit the comma at the end of a line
> - add trailing commas and
> - use multiline strings with proper whitespace handling.
>
> These changes should make it easer to read and write configs while 
> still preserving the power of JSON.

> Thoughts?

I read through the document with interest. It's a nice idea. I don't 
discourage it in general. But...

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.

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".

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

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.

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.

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

Regards,

Sean