Re: [apps-discuss] JSON Patch

Graham Klyne <GK@ninebynine.org> Wed, 23 November 2011 07:11 UTC

Return-Path: <GK@ninebynine.org>
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 4EC8A1F0C57 for <apps-discuss@ietfa.amsl.com>; Tue, 22 Nov 2011 23:11:00 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.81
X-Spam-Level:
X-Spam-Status: No, score=-5.81 tagged_above=-999 required=5 tests=[AWL=-0.280, BAYES_00=-2.599, DATE_IN_PAST_06_12=1.069, RCVD_IN_DNSWL_MED=-4]
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 Af8QoveeStKT for <apps-discuss@ietfa.amsl.com>; Tue, 22 Nov 2011 23:10:59 -0800 (PST)
Received: from relay9.mail.ox.ac.uk (relay9.mail.ox.ac.uk [163.1.2.169]) by ietfa.amsl.com (Postfix) with ESMTP id 7860721F8A35 for <apps-discuss@ietf.org>; Tue, 22 Nov 2011 23:10:58 -0800 (PST)
Received: from smtp0.mail.ox.ac.uk ([129.67.1.205]) by relay9.mail.ox.ac.uk with esmtp (Exim 4.75) (envelope-from <GK@ninebynine.org>) id 1RT6t4-0006DW-Th; Wed, 23 Nov 2011 07:04:54 +0000
Received: from gklyne.plus.com ([80.229.154.156] helo=Eskarina.local) by smtp0.mail.ox.ac.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from <GK@ninebynine.org>) id 1RT6t4-0005Pv-09; Wed, 23 Nov 2011 07:04:54 +0000
Message-ID: <4ECC0198.6040103@ninebynine.org>
Date: Tue, 22 Nov 2011 20:10:00 +0000
From: Graham Klyne <GK@ninebynine.org>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:6.0) Gecko/20110812 Thunderbird/6.0
MIME-Version: 1.0
To: Julian Reschke <julian.reschke@gmx.de>
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>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Oxford-Username: zool0635
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: Wed, 23 Nov 2011 07:11:00 -0000

On 22/11/2011 16:05, Julian Reschke wrote:
> 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"]
> }

Er, aren't Javascript arrays 0-based?  I'd expect the same to apply to JSON.

I'd also suggest instead of
   "an inserting it again at the position "to"."
to say
   "and inserting it again so that it occupies position "to" in the resulting 
array."

This just avoids any ambiguity about whether or not "to" is specified with 
respect to the original array before removing the element to be moved.

#g