[Json] JSON by example

John Cowan <cowan@mercury.ccil.org> Thu, 26 May 2016 20:50 UTC

Return-Path: <cowan@ccil.org>
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 C3AAD12D9BF for <json@ietfa.amsl.com>; Thu, 26 May 2016 13:50:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.027
X-Spam-Level:
X-Spam-Status: No, score=-4.027 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-1.426, SPF_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 2WNAk8rVE1Ni for <json@ietfa.amsl.com>; Thu, 26 May 2016 13:50:42 -0700 (PDT)
Received: from earth.ccil.org (earth.ccil.org [192.190.237.11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E176212D9D2 for <json@ietf.org>; Thu, 26 May 2016 13:50:39 -0700 (PDT)
Received: from cowan by earth.ccil.org with local (Exim 4.72) (envelope-from <cowan@ccil.org>) id 1b62Ej-0000a9-Mh; Thu, 26 May 2016 16:50:33 -0400
Date: Thu, 26 May 2016 16:50:33 -0400
From: John Cowan <cowan@mercury.ccil.org>
To: Phillip Hallam-Baker <ietf@hallambaker.com>
Message-ID: <20160526205033.GD19074@mercury.ccil.org>
References: <CAMm+Lwg2rWh0_gjXnSAEAvWtsMO1U3UiA8jsBzc+rRR6fiKcJg@mail.gmail.com> <20160526173719.GA19074@mercury.ccil.org> <CAMm+Lwgzdw5gBdBvmA6aHQ55mcHXnQzabrfdA4DObtyReauuWA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CAMm+Lwgzdw5gBdBvmA6aHQ55mcHXnQzabrfdA4DObtyReauuWA@mail.gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Sender: John Cowan <cowan@ccil.org>
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/EedcaX8TqPGv7Hxzv-ISRzAMqNk>
Cc: Tim Bray <tbray@textuality.com>, "json@ietf.org" <json@ietf.org>, Austin William Wright <aaa@bzfx.net>, Andrew Newton <andy@hxr.us>
Subject: [Json] JSON by example
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: Thu, 26 May 2016 20:50:45 -0000

Phillip Hallam-Baker scripsit:

> 'Wirthless'

"You may call me by value, and call me 'Worth', or you may call me by
name, and call me 'Veert'."  --Wirth on how to say his name.

> Yes, real numbers and integers are probably things you want to be able
> to treat differently in code because it is very very rare to need or
> want a real64 number in a protocol.

Okay, an integer encodes the type "JSON number which is an integer",
and a non-integer encodes the type "JSON number".  Note that this might
be represented as a Java BigDecimal or equivalent.

> But I think that you absolutely want to be able to put binary blobs of
> data in a stream and distinguish them from strings.

Good idea.  If the string is "deadbeef", it encodes the type of binary
blobs represented in JSON as a string. :-)

> That is an interesting one because it comes down to how do you want
> extensibility to work. In particular, when do you want adding things
> to be backwards compatible and when do you want to cause things to
> halt rather than have an application try to act on data it did not
> fully understand?

I think you want to be able to choose, but I'm not sure how to represent
it within the JSON-by-example format.  The obvious way is to reserve a
key like "...", but I haven't wanted to do that.

> This is actually a little problematic as in JSON any slot can hold
> null while many languages don't allow integers or booleans to be null.

True.  We can say then that null is always permitted wherever the schema
allows an array or object.

-- 
John Cowan          http://www.ccil.org/~cowan        cowan@ccil.org
How they ever reached any conclusion at all is starkly unknowable
to the human mind.        --"Backstage Lensman", Randall Garrett