[Json] Extending JSON Patch (or JSON Pointer) to include indexing into a string

Mitar <mmitar@gmail.com> Fri, 04 October 2019 06:02 UTC

Return-Path: <mmitar@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ABA7F1200F6 for <json@ietfa.amsl.com>; Thu, 3 Oct 2019 23:02:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oTwI1Vt0YrTA for <json@ietfa.amsl.com>; Thu, 3 Oct 2019 23:02:33 -0700 (PDT)
Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 856791200F5 for <json@ietf.org>; Thu, 3 Oct 2019 23:02:33 -0700 (PDT)
Received: by mail-lj1-x22b.google.com with SMTP id 7so5220655ljw.7 for <json@ietf.org>; Thu, 03 Oct 2019 23:02:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=xA3GSfztuCu8eAu/m+YdmunaaptTY9tLoq3U3TZxptY=; b=jf6q2TSY35vUmtH4xXxCFvucfdegOBnhdmPLJrOfFCmwd7xZ76XpGcQvYhOgFcZmBL ZQnKl0TJ/5ZkiYG8qnwb1ByGvoCefErJ+CvsKndL2PzxQrtRbKu/E2GplBy4+sbN7VFq evnX1jg9aEN9mMVNouYKpSFzdYS7XkOgS3GA5Mtoh7nW8Lv4yuX6a1UxBVFKOGx//b99 XXCEVWrFqwoWcZXHa1USnKLj7MI44iNW7Lt14rj3oSRTS1RiKcprXiFoL9qZFUneuzth ZIR9rXkng0X+W8NFpQkYgbWQu5wt0/jAT3U5bg0lVffXfHsIq3iDDGTJLXCQ6EqXEW5g WW8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=xA3GSfztuCu8eAu/m+YdmunaaptTY9tLoq3U3TZxptY=; b=RCJupqZllXoi7YJ6+QkDnTfdoden9Tfb/gs9UT7//2uZf5cnG6SyQh50rXjVDfJfRC xjDSAo+yKq3wSo6ErDPxF6r/HhRv4XqSRCNHIhiXtuc86Q7Fmb0JyGRlZ8dNJ/GEoX1X ytZhifWFBaZW9IS2u3bAkmJxCEEzZbJlckP4HoQ7fXZVrrTMaq/LSfnNxGnKKB2iommc vLJ3M0VE3OP+tHUn/rs6qg+0G/lU3VNg+il2Ll7DcyUzhiNbUGbEE0uuzlw321mC5BLZ bQnQp3Y8f5/9yUwTqwEX1Znkf8Uka5jSn8V5dEirFdA8XtW9rkzZz7zjDgyyOhn59bDS jyKA==
X-Gm-Message-State: APjAAAVy7lFZue9gUdAz9Ucm4AG8zubSEtqG9+bSIV27A8UYYaqgDuCI 54cuuc7dYQpzDcB9FxV3q8qR0BUeX5oPhiz8speykPI2
X-Google-Smtp-Source: APXvYqz/pIyRscSmneOGptw1TWTfxXi5UyJbbnWdWqMCGvyUotK38dWHfDfPfWAXn6ct/qgGtEf7MEYvzXLV7gu5ikQ=
X-Received: by 2002:a2e:b0d1:: with SMTP id g17mr8441127ljl.238.1570168951314; Thu, 03 Oct 2019 23:02:31 -0700 (PDT)
MIME-Version: 1.0
From: Mitar <mmitar@gmail.com>
Date: Thu, 03 Oct 2019 23:02:19 -0700
Message-ID: <CAKLmikN0nNKL7Fyt4wn77_Nd1N9=UZE=jdcGKvb6v0z_LF0zUA@mail.gmail.com>
To: json@ietf.org
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/ALaAI0tXkidJCz4Tr8qp0dq2Bh8>
Subject: [Json] Extending JSON Patch (or JSON Pointer) to include indexing into a string
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 04 Oct 2019 06:02:36 -0000

Hi!

I really like JSON Patch with its simplicity, but what I am missing is
that it does not allow expressing a patch to a string itself. So if
you have a long string value (like a text document) and you would like
to describe a patch which modifies a part of such string, currently
you have to provide the whole new string, instead of just a patch to
the string.

So what do people think about supporting a patch (probably by simply
extending JSON Pointer) to allow specifying for JSON like:

{"value": "foobar"}

A patch like:

[
  {"op": "replace", "path": "/value/0-3", "value": "no"}
]

Replacing first three characters with "no' and resulting in:

{"value": "nobar"}

So upper limit would be exclusive. You could also specify "2-" to
select all characters from the 3rd character to the end.

Also, I have no experience with the IETF process on how would one go
about introducing such a change to existing standards.


Mitar

-- 
http://mitar.tnode.com/
https://twitter.com/mitar_m