Re: [apps-discuss] JSON Patch

"Manger, James H" <James.H.Manger@team.telstra.com> Wed, 23 November 2011 01:21 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 987D721F85CE for <apps-discuss@ietfa.amsl.com>; Tue, 22 Nov 2011 17:21:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.828
X-Spam-Level:
X-Spam-Status: No, score=-2.828 tagged_above=-999 required=5 tests=[AWL=-2.527, BAYES_00=-2.599, HELO_EQ_AU=0.377, HOST_EQ_AU=0.327, J_CHICKENPOX_14=0.6, 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 aIvFsGH1tYJU for <apps-discuss@ietfa.amsl.com>; Tue, 22 Nov 2011 17:21:27 -0800 (PST)
Received: from ipxbvo.tcif.telstra.com.au (ipxbvo.tcif.telstra.com.au [203.35.135.204]) by ietfa.amsl.com (Postfix) with ESMTP id BF5BE21F85BB for <apps-discuss@ietf.org>; Tue, 22 Nov 2011 17:21:26 -0800 (PST)
X-IronPort-AV: E=Sophos;i="4.69,556,1315144800"; d="scan'208";a="53155144"
Received: from unknown (HELO ipcavi.tcif.telstra.com.au) ([10.97.217.200]) by ipobvi.tcif.telstra.com.au with ESMTP; 23 Nov 2011 12:21:19 +1100
X-IronPort-AV: E=McAfee;i="5400,1158,6538"; a="43308362"
Received: from wsmsg3701.srv.dir.telstra.com ([172.49.40.169]) by ipcavi.tcif.telstra.com.au with ESMTP; 23 Nov 2011 12:21:19 +1100
Received: from WSMSG3153V.srv.dir.telstra.com ([172.49.40.159]) by WSMSG3701.srv.dir.telstra.com ([172.49.40.169]) with mapi; Wed, 23 Nov 2011 12:21:18 +1100
From: "Manger, James H" <James.H.Manger@team.telstra.com>
To: Julian Reschke <julian.reschke@gmx.de>, "Paul C. Bryan" <paul.bryan@forgerock.com>
Date: Wed, 23 Nov 2011 12:21:17 +1100
Thread-Topic: [apps-discuss] JSON Patch
Thread-Index: AcypMJurq5l2xMAhRPiWTwRsULnzfgASB5Cg
Message-ID: <255B9BB34FB7D647A506DC292726F6E113884047C4@WSMSG3153V.srv.dir.telstra.com>
References: <4EB1482E.1040600@adobe.com> <4EB14C2E.8040208@gmx.de> <1320254564.2622.37.camel@neutron> <4EBBA0DD.9020605@gmx.de> <4ECBC843.60900@gmx.de>
In-Reply-To: <4ECBC843.60900@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="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: "apps-discuss@ietf.org" <apps-discuss@ietf.org>
Subject: Re: [apps-discuss] JSON Patch
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: Wed, 23 Nov 2011 01:21:27 -0000

JSON pointer array indices start at zero so the example patch document below actually moves "qux" to the end of the array, instead of "bar" to the middle.


On escaping: how about replacing every '/' in an object member's name with the Unicode REPLACEMENT CHARACTER U+FFFD when creating a JSON pointer.

It means a JSON pointer cannot reference an object member that actually has a U+FFFD char in its name, but that seems so unlikely that it could be an acceptable restriction.
Escaping and unescaping is easy: eg in Java s.replace('/', '\uFFFD') to escape; s.replace('\uFFFD', '/') to unescape.
It should cause less confusion when another layer (eg URI, fragment...) adds escaping, such as %xx.


--
James Manger

-----Original Message-----
From: apps-discuss-bounces@ietf.org [mailto:apps-discuss-bounces@ietf.org] On Behalf Of Julian Reschke
Sent: Wednesday, 23 November 2011 3:05 AM
To: Paul C. Bryan
Cc: apps-discuss@ietf.org
Subject: Re: [apps-discuss] JSON Patch

On 2011-11-10 11:01, Julian Reschke wrote:
> On 2011-11-02 18:22, Paul C. Bryan wrote:
>> Thanks everyone for the feedback so far. Some replies:
>>
>> On Wed, 2011-11-02 at 13:39 +0000, Michael Dürig wrote:
>>> What is missing (wrt. to [2]) is a reorder operation.
>>
>> The ability to move items in an array has come up and seems
>> straightforward. A need (and semantics) of moving a value between two
>> arbitrary locations in a JSON document is not well understood.
>
> +1. So are you planning to add this? Would it make sense to make a
> concrete proposal?
> ...

OK, here's draft proposal:

4.4. move

    The "move" operation moves an existing array element. The "to" 
member indicates the array position as integer value. This operation is 
equivalent to removing the element identified by "move", an inserting it 
again at the position "to".


Example:

    An example target JSON document:

    {
        "foo": [ "bar", "qux", "baz" ]
    }

    A JSON Patch document:

    [
        { "move": "/foo/1", "to": 2}
    ]

    The resulting JSON document:

    {
        "foo": ["qux", "bar", "baz"]
    }

Q: is a special case like "end" needed?

Best regards, Julian
_______________________________________________
apps-discuss mailing list
apps-discuss@ietf.org
https://www.ietf.org/mailman/listinfo/apps-discuss