Re: [Json] JSON irritants

"Manger, James" <James.H.Manger@team.telstra.com> Wed, 03 August 2016 06:16 UTC

Return-Path: <James.H.Manger@team.telstra.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 B30F412D11A for <json@ietfa.amsl.com>; Tue, 2 Aug 2016 23:16:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.619
X-Spam-Level:
X-Spam-Status: No, score=-2.619 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] 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 ivm8WwmsJMXh for <json@ietfa.amsl.com>; Tue, 2 Aug 2016 23:16:17 -0700 (PDT)
Received: from ipxcno.tcif.telstra.com.au (ipxcno.tcif.telstra.com.au [203.35.82.208]) by ietfa.amsl.com (Postfix) with ESMTP id B7C82120727 for <json@ietf.org>; Tue, 2 Aug 2016 23:16:16 -0700 (PDT)
X-IronPort-AV: E=Sophos; i="5.28,464,1464616800"; d="scan'208,217"; a="94075926"
Received: from unknown (HELO ipcbni.tcif.telstra.com.au) ([10.97.216.204]) by ipocni.tcif.telstra.com.au with ESMTP; 03 Aug 2016 16:15:56 +1000
X-IronPort-AV: E=McAfee;i="5700,7163,8245"; a="161119971"
Received: from wsmsg3757.srv.dir.telstra.com ([172.49.40.85]) by ipcbni.tcif.telstra.com.au with ESMTP; 03 Aug 2016 16:15:56 +1000
Received: from WSMSG3153V.srv.dir.telstra.com ([172.49.40.159]) by wsmsg3757.srv.dir.telstra.com ([fe80::8dc9:173:3b72:6577%23]) with mapi; Wed, 3 Aug 2016 16:15:56 +1000
From: "Manger, James" <James.H.Manger@team.telstra.com>
To: Tim Bray <tbray@textuality.com>, "json@ietf.org" <json@ietf.org>
Date: Wed, 3 Aug 2016 16:15:54 +1000
Thread-Topic: [Json] JSON irritants
Thread-Index: AdHtRm+U0ShfDAAoToiTdZoZlldlzAAAnH2A
Message-ID: <255B9BB34FB7D647A506DC292726F6E13BFDE57E14@WSMSG3153V.srv.dir.telstra.com>
References: <CAHBU6iv+S5=bxh62G+ybcgUWzQLUngVSti8X1ptENn0fA=i3ng@mail.gmail.com>
In-Reply-To: <CAHBU6iv+S5=bxh62G+ybcgUWzQLUngVSti8X1ptENn0fA=i3ng@mail.gmail.com>
Accept-Language: en-US, en-AU
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: en-US, en-AU
Content-Type: multipart/alternative; boundary="_000_255B9BB34FB7D647A506DC292726F6E13BFDE57E14WSMSG3153Vsrv_"
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/pqZDIzSmw5uaCeKPvl0FUCVPaTc>
Subject: Re: [Json] JSON irritants
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, 03 Aug 2016 06:16:20 -0000

Yuck for i800 and f49.399. I’d prefer the presence of a decimal point “.” or exponent symbol “e” to imply a float; and their absence to imply an integer.

Optional commas sounds okay. I wouldn’t like to forbid them as [11, 234, 5, 6] is nicer than [11 234 5 6].

Encouraging yyyy-mm-ddThh:mm:ss[.sss…]Z for instants of time is great. I’m less sure that distinguishing it from a string is so crucial.

--
James Manger

From: json [mailto:json-bounces@ietf.org] On Behalf Of Tim Bray
Sent: Wednesday, 3 August 2016 3:18 PM
To: json@ietf.org
Subject: [Json] JSON irritants

I have recently been doing an unreasonable amount of JSON work, what with editing the drafts here, helping design AWS’s CloudWatch Events service [1], and now working on an interesting JSON DSL that with any luck will decloak later this year.

I have encountered the following irritants:

1. When hand-editing JSON, it is unreasonably difficult to get the commas right.
2. When using JSON numbers, the sender *always* knows whether integers or floats are intended, but there’s no way to communicate this information.
3. There is no timestamp literal.

Then I realized that the comma is not necessary to the grammar, it’s only there for JavaScript compatibility.  Bah.  Anyhow, here’s the example object from RFC7159:

   {
     "Image": {
         "Width":  800,
         "Height": 600,
         "Title":  "View from 15th Floor",
         "Thumbnail": {
             "Url":    "http://www.example.com/image/481989943",
             "Height": 125,
             "Width":  100
         },
         "Animated" : false,
         "IDs": [116, 943, 234, 38793]
       }
   }

Here’s a version with a couple more fields and the irritants removed:

  {
     "Image": {
         "Width":  i800
         "Height": i600
         "Title":  "View from 15th Floor"
         "Thumbnail": {
             "Url":    "http://www.example.com/image/481989943"
             "Height": i125
             "Width":  i100
         }
         "Location": {
             "Latitude": f49.399673
             "Longitude": f-123.508437
         }
         "Animated" : false
         "Capture Time": @2016-08-01T18:15:00Z
         "IDs": [i116 i943 i234 i38793]
       }
   }


I thought of a friendly acronym and bought a domain name and wrote an I-D too, but I thought it might be polite and useful to test the waters here, example first.

[1] http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CloudWatchEventsandEventPatterns.html