Re: [apps-discuss] JSON Patch

"Manger, James H" <> Wed, 23 November 2011 01:21 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 987D721F85CE for <>; Tue, 22 Nov 2011 17:21:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.828
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 ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id aIvFsGH1tYJU for <>; Tue, 22 Nov 2011 17:21:27 -0800 (PST)
Received: from ( []) by (Postfix) with ESMTP id BF5BE21F85BB for <>; 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 ([]) by with ESMTP; 23 Nov 2011 12:21:19 +1100
X-IronPort-AV: E=McAfee;i="5400,1158,6538"; a="43308362"
Received: from ([]) by with ESMTP; 23 Nov 2011 12:21:19 +1100
Received: from ([]) by ([]) with mapi; Wed, 23 Nov 2011 12:21:18 +1100
From: "Manger, James H" <>
To: Julian Reschke <>, "Paul C. Bryan" <>
Date: Wed, 23 Nov 2011 12:21:17 +1100
Thread-Topic: [apps-discuss] JSON Patch
Thread-Index: AcypMJurq5l2xMAhRPiWTwRsULnzfgASB5Cg
Message-ID: <>
References: <> <> <1320254564.2622.37.camel@neutron> <> <>
In-Reply-To: <>
Accept-Language: en-US, en-AU
Content-Language: en-US
acceptlanguage: en-US, en-AU
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: "" <>
Subject: Re: [apps-discuss] JSON Patch
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-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: [] On Behalf Of Julian Reschke
Sent: Wednesday, 23 November 2011 3:05 AM
To: Paul C. Bryan
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".


    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