Re: [apps-discuss] JSON Patch: jsondiff and syntax

Julian Reschke <> Mon, 12 December 2011 09:25 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 514FC21F8A67 for <>; Mon, 12 Dec 2011 01:25:36 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -104.63
X-Spam-Status: No, score=-104.63 tagged_above=-999 required=5 tests=[AWL=-2.031, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id HNHw3KSXzGiA for <>; Mon, 12 Dec 2011 01:25:35 -0800 (PST)
Received: from ( []) by (Postfix) with SMTP id 6329621F8A64 for <>; Mon, 12 Dec 2011 01:25:34 -0800 (PST)
Received: (qmail invoked by alias); 12 Dec 2011 09:25:33 -0000
Received: from (EHLO []) [] by (mp021) with SMTP; 12 Dec 2011 10:25:33 +0100
X-Authenticated: #1915285
X-Provags-ID: V01U2FsdGVkX1+b6/dPkH+bm8ZkpWRn+da4BlFeEFPauT55Nax6LV 2QZ7gOgZRbWjey
Message-ID: <>
Date: Mon, 12 Dec 2011 10:25:30 +0100
From: Julian Reschke <>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: "Roy T. Fielding" <>
References: <> <>
In-Reply-To: <>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
Cc: Martin Algesten <>,
Subject: Re: [apps-discuss] JSON Patch: jsondiff and syntax
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: Mon, 12 Dec 2011 09:25:36 -0000

On 2011-12-12 00:03, Roy T. Fielding wrote:
> FWIW, discussion of which format is best for a diff should really be based
> on what is being compared (a file or an abstract memory structure?) and what
> is expected to process the diff.
> For example, JSOP has a diff format
> that should be evaluated based on comparing JCR repository trees and an
> understanding that the main processor is going to be a server-side patch
> implementation.  Given that context, our JSON represents a state of the
> JCR repository: the actual diff format does not need to be JSON because
> it won't be processed by a browser (only generated by XHR).
> ...

I think the question here is whether Javascript is used to generate (1) 
and to process (2) the format.

For (1), it should work with XHR. JSON-Patch just is a 
JSON-serialization of a JavaScript object. The author won't need to 
write a serializer. In JSOP's diff format, the author will have to 
combine custom elements with serialized Javascript objects. As such, the 
JSON parts of the diff format shouldn't make assumptions about 
Javascript that may not be true, such as member ordering (right now it 
does sort of).

For (2), the question of what parses the format is much more 
interesting. Sure, it won't be a browser. But with JSON Patch, it can be 
an off-the-shelf JSON library (such as Jackson).

Finally, two general points:

1) I'm not sure why verbosity is a problem. If it is, we can always 
Transfer/Content-encode gzip. For readability, we could switch from 
names like "add" to symbols like "+".

2) Compact formats can be a success; see Relax NG Compact Notation. I 
think the lesson to learn here is that there should be a 1-1 mapping 
between the compact notation and the verbose notation. That's currently 
not the case for JSOP's diff format, and I believe that's a problem.

Best regards, Julian