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

From: "Manger, James H" <[email-masked]>
Date: Thu, 1 Nov 2012 17:24:28 +1100

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