Re: [apps-discuss] draft-ietf-appsawg-json-pointer escape characters

"Manger, James H" <James.H.Manger@team.telstra.com> Fri, 13 April 2012 04:04 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 65DD821F8792 for <apps-discuss@ietfa.amsl.com>; Thu, 12 Apr 2012 21:04:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.591
X-Spam-Level:
X-Spam-Status: No, score=-0.591 tagged_above=-999 required=5 tests=[AWL=0.310, BAYES_00=-2.599, HELO_EQ_AU=0.377, HOST_EQ_AU=0.327, RELAY_IS_203=0.994]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gwE+yBlSpbGA for <apps-discuss@ietfa.amsl.com>; Thu, 12 Apr 2012 21:04:59 -0700 (PDT)
Received: from ipxavo.tcif.telstra.com.au (ipxavo.tcif.telstra.com.au [203.35.135.200]) by ietfa.amsl.com (Postfix) with ESMTP id 9A01421F8783 for <apps-discuss@ietf.org>; Thu, 12 Apr 2012 21:04:57 -0700 (PDT)
X-IronPort-AV: E=Sophos;i="4.75,414,1330866000"; d="scan'208";a="69534363"
Received: from unknown (HELO ipccvi.tcif.telstra.com.au) ([10.97.217.208]) by ipoavi.tcif.telstra.com.au with ESMTP; 13 Apr 2012 14:04:57 +1000
X-IronPort-AV: E=McAfee;i="5400,1158,6678"; a="58317212"
Received: from wsmsg3707.srv.dir.telstra.com ([172.49.40.81]) by ipccvi.tcif.telstra.com.au with ESMTP; 13 Apr 2012 14:04:57 +1000
Received: from WSMSG3153V.srv.dir.telstra.com ([172.49.40.159]) by wsmsg3707.srv.dir.telstra.com ([172.49.40.81]) with mapi; Fri, 13 Apr 2012 14:04:56 +1000
From: "Manger, James H" <James.H.Manger@team.telstra.com>
To: Julian Reschke <julian.reschke@gmx.de>, "apps-discuss@ietf.org" <apps-discuss@ietf.org>
Date: Fri, 13 Apr 2012 14:04:55 +1000
Thread-Topic: [apps-discuss] draft-ietf-appsawg-json-pointer escape characters
Thread-Index: Ac0YwbSS9fhKKiN3SW6F364RGuT3pgAYKrbw
Message-ID: <255B9BB34FB7D647A506DC292726F6E114F079B4E0@WSMSG3153V.srv.dir.telstra.com>
References: <4F86F5E9.1040202@gmx.de>
In-Reply-To: <4F86F5E9.1040202@gmx.de>
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="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [apps-discuss] draft-ietf-appsawg-json-pointer escape characters
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: Fri, 13 Apr 2012 04:04:59 -0000

If we really want URL-friendly escapes for JSON pointers pick '~' as the escape character. Use '~0' and '~1' as escapes for a '~' and '/' in a JSON member name respectively. If we want a different separator (eg ';') to distinguish arrays vs objects in pointers, escape it as '~2'.

{ "a/b": true, "c~d": false, "d":{"e":null}, "f;g":null, "h":[100,200] }

JSON pointers to items in the above JSON value could be:
  /a~1b
  /c~0d
  /d/e
  /f~2g
  /h;0

These 5 can go in a URI query parameter or fragment without any %-escaping.
You still need URI %-escaping for other characters (eg for pointer "/<hi>" to fragment "#/%3Chi%3E") so the receiver always needs to do %-unescaping, but there should be less confusion between JSON pointer and URI layers. It is mostly harmless to apply %-escaping more than necessary (eg it doesn't matter whether or not the pointer "/a~1b" is put in a URI fragment as "#/a~1b" or "#%2fa~1b" or "#%2fa%7eb").

--
James Manger