[apps-discuss] JSON Patch: jsondiff and syntax

Martin Algesten <martin@algesten.se> Sun, 11 December 2011 03:05 UTC

Return-Path: <martin@algesten.se>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost []) by ietfa.amsl.com (Postfix) with ESMTP id 9A93A21F8B17 for <apps-discuss@ietfa.amsl.com>; Sat, 10 Dec 2011 19:05:46 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.229
X-Spam-Status: No, score=-3.229 tagged_above=-999 required=5 tests=[AWL=0.370, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([]) by localhost (ietfa.amsl.com []) (amavisd-new, port 10024) with ESMTP id rUtt329BBYsK for <apps-discuss@ietfa.amsl.com>; Sat, 10 Dec 2011 19:05:45 -0800 (PST)
Received: from mail-lpp01m010-f44.google.com (mail-lpp01m010-f44.google.com []) by ietfa.amsl.com (Postfix) with ESMTP id 81CA021F8B12 for <apps-discuss@ietf.org>; Sat, 10 Dec 2011 19:05:45 -0800 (PST)
Received: by laah2 with SMTP id h2so907173laa.31 for <apps-discuss@ietf.org>; Sat, 10 Dec 2011 19:05:44 -0800 (PST)
Received: by with SMTP id si2mr8667437lab.8.1323572744363; Sat, 10 Dec 2011 19:05:44 -0800 (PST)
Received: from [] (bams-c131.cust.svensktbredband.se. []) by mx.google.com with ESMTPS id iy5sm12253243lab.16.2011. (version=TLSv1/SSLv3 cipher=OTHER); Sat, 10 Dec 2011 19:05:43 -0800 (PST)
From: Martin Algesten <martin@algesten.se>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Date: Sun, 11 Dec 2011 04:05:42 +0100
Message-Id: <0B1C718E-60C2-4F89-967B-7532C9AC96F7@algesten.se>
To: apps-discuss@ietf.org
Mime-Version: 1.0 (Apple Message framework v1251.1)
X-Mailer: Apple Mail (2.1251.1)
Subject: [apps-discuss] JSON Patch: jsondiff and syntax
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: Sun, 11 Dec 2011 03:06:16 -0000

(Sorry Paul C. Bryan, I'm stalking you from list to list. ;)

This is in reference to a discussion from a couple of days back 

Parallel to Paul's work I've dreamt up another JSON patch syntax and implemented a diff/patch tool here:


I don't agree that the verbosity of the JSON Patch RFC (http://tools.ietf.org/html/draft-pbryan-json-patch-04) is okay.

I believe one of the big reasons that JSON has gained such popularity over say XML, is the simplicity of it. The simplicity is gained by a loss of semantics or perhaps better call it "inferred" semantics. Such inference are even more obvious in other terse data exchange formats such as YAML.

JSON Patch goes against this by having very explicit verbs "add", "replace", "move" etc. I don't buy the argument that using gzip transfer encoding solves this. XML compresses amazingly well, but I rather see that as an argument that something is wrong in the format to start off with.

I also think about things like "diff -u" where the '+/-' becomes second nature and the patches are very readable. Currently a JSON Patch file is an instruction list of mutations - almost like a programming language, which for me is different to a diff. But then I'm clearly biased :)