@braid.org/json-patch

1.0.6 • Public • Published

JSON Patch

This library patches JSON objects using the Braid range-patch format.

Using it:

var patch = require('@braid.org/json-patch')
var json = {a: "foo", b: [1,2,3]}

// Replace the 2 with "a new string"
patch(json, '.b[3]', "a new string")

console.log(json)   // {a: "foo", b: [1, "a new string", 3]}

// Edit that string
patch(json, '.b[3][1:5]', 'n old')

console.log(json)   // {a: "foo", b: [1, "an old string", 3]}

This library mutates your JSON objects in-place. If you want a copy, then clone your object first.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @braid.org/json-patch

      Weekly Downloads

      0

      Version

      1.0.6

      License

      ISC

      Unpacked Size

      5.44 kB

      Total Files

      4

      Last publish

      Collaborators

      • toomim
      • canadaduane
      • josephg
      • glittle