[apps-discuss] JSON pointer: disallow leading 0s in array indicies

"Manger, James H" <James.H.Manger@team.telstra.com> Thu, 01 November 2012 06:24 UTC

Return-Path: <James.H.Manger@team.telstra.com>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1E88121F84FF for <apps-discuss@ietfa.amsl.com>; Wed, 31 Oct 2012 23:24:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.436
X-Spam-Level:
X-Spam-Status: No, score=-0.436 tagged_above=-999 required=5 tests=[AWL=0.465, BAYES_00=-2.599, HELO_EQ_AU=0.377, HOST_EQ_AU=0.327, RELAY_IS_203=0.994]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hfaxA95l1jyv for <apps-discuss@ietfa.amsl.com>; Wed, 31 Oct 2012 23:24:34 -0700 (PDT)
Received: from ipxbno.tcif.telstra.com.au (ipxbno.tcif.telstra.com.au [203.35.82.204]) by ietfa.amsl.com (Postfix) with ESMTP id 5417C21F84FE for <apps-discuss@ietf.org>; Wed, 31 Oct 2012 23:24:33 -0700 (PDT)
X-IronPort-AV: E=Sophos;i="4.80,692,1344175200"; d="scan'208";a="99082675"
Received: from unknown (HELO ipcani.tcif.telstra.com.au) ([10.97.216.200]) by ipobni.tcif.telstra.com.au with ESMTP; 01 Nov 2012 17:24:31 +1100
X-IronPort-AV: E=McAfee;i="5400,1158,6882"; a="45244131"
Received: from wsmsg3703.srv.dir.telstra.com ([172.49.40.171]) by ipcani.tcif.telstra.com.au with ESMTP; 01 Nov 2012 17:24:31 +1100
Received: from WSMSG3153V.srv.dir.telstra.com ([172.49.40.159]) by WSMSG3703.srv.dir.telstra.com ([172.49.40.171]) with mapi; Thu, 1 Nov 2012 17:24:30 +1100
From: "Manger, James H" <James.H.Manger@team.telstra.com>
To: IETF Apps Discuss <apps-discuss@ietf.org>
Date: Thu, 01 Nov 2012 17:24:28 +1100
Thread-Topic: JSON pointer: disallow leading 0s in array indicies
Thread-Index: Ac23+YwakS2yVF5tTQalZzKadD4nsg==
Message-ID: <255B9BB34FB7D647A506DC292726F6E114FFE16053@WSMSG3153V.srv.dir.telstra.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: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Subject: [apps-discuss] JSON pointer: disallow leading 0s in array indicies
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Nov 2012 06:24:35 -0000

The JSON pointer spec allows /007 as a valid pointer to the 8th item in a JSON array, in addition to /7, and /07 etc. I think we should change this to disallow leading zeros.

No one needs unnecessary leading zeros.
No one will insert unnecessary leading zeros, either manually or from a program.
Adding leading zeros simply isn't a "common mistake" anyone makes for decimal integers so there is no point in supporting it in an attempt to be lenient.
Leading zeros just add the risk that a value will be misinterpreted as octal somewhere.

Disallowing leading zeros makes JSON pointers unique. Any item in a JSON structure has exactly 1 JSON pointer to identify it. This is a nice feature to have.
Many apps will only need a JSON pointer to be unambiguous, but some will benefit from them being unique.

Suggested change to section 4 "Evaluation", 2nd dot point, of draft-ietf-appsawg-json-pointer-05:
OLD
  * characters that represent an unsigned base-10 integer value
    (possibly with leading zeros)
NEW
  * characters that represent an unsigned base-10 integer value
    (without any unnecessary leading zeros)


--
James Manger