Re: [apps-discuss] JSON Patch

Julian Reschke <julian.reschke@gmx.de> Tue, 22 November 2011 16:05 UTC

Return-Path: <julian.reschke@gmx.de>
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 BCB601F0CA0 for <apps-discuss@ietfa.amsl.com>; Tue, 22 Nov 2011 08:05:46 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -104.054
X-Spam-Level:
X-Spam-Status: No, score=-104.054 tagged_above=-999 required=5 tests=[AWL=-1.455, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
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 4yz9VsWfrXgc for <apps-discuss@ietfa.amsl.com>; Tue, 22 Nov 2011 08:05:46 -0800 (PST)
Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.22]) by ietfa.amsl.com (Postfix) with SMTP id 476B51F0CB2 for <apps-discuss@ietf.org>; Tue, 22 Nov 2011 08:05:45 -0800 (PST)
Received: (qmail invoked by alias); 22 Nov 2011 16:05:44 -0000
Received: from mail.greenbytes.de (EHLO [192.168.1.140]) [217.91.35.233] by mail.gmx.net (mp056) with SMTP; 22 Nov 2011 17:05:44 +0100
X-Authenticated: #1915285
X-Provags-ID: V01U2FsdGVkX18xm/59F24x1xmHSg9xBXvZmCkJYuq6sXlON9tOOF PJPfcSvmMZPV1w
Message-ID: <4ECBC843.60900@gmx.de>
Date: Tue, 22 Nov 2011 17:05:23 +0100
From: Julian Reschke <julian.reschke@gmx.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: "Paul C. Bryan" <paul.bryan@forgerock.com>
References: <4EB1482E.1040600@adobe.com> <4EB14C2E.8040208@gmx.de> <1320254564.2622.37.camel@neutron> <4EBBA0DD.9020605@gmx.de>
In-Reply-To: <4EBBA0DD.9020605@gmx.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Y-GMX-Trusted: 0
Cc: 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: Tue, 22 Nov 2011 16:05:46 -0000

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