Developer tools

JSON Merge Patch

Apply an object merge patch or replace a JSON target with a new value.

JSON Merge Patch
Esc to restore

Your inputs

UTF-8 JSON up to 2 MB, 50,000 values and 64 levels. Duplicate object member names are rejected; numeric tokens are preserved.

UTF-8 JSON, NDJSON or GeoJSON up to 2 MB. Files stay on this device.

UTF-8 JSON up to 2 MB, 50,000 values and 64 levels. Duplicate object member names are rejected; numeric tokens are preserved.

UTF-8 JSON, NDJSON or GeoJSON up to 2 MB. Files stay on this device.

Results update as you type. Larger files run when you press Update result.

Your result

LOCAL & PRIVATE

Your result will appear here.

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

Applies RFC 7396 recursively: object patches merge members, null member values delete keys, and non-object patches replace the whole target. Arrays are replaced as complete values rather than merged by index. An object patch starts from an empty object when the target is not an object. Reserved JavaScript property names are treated as ordinary JSON keys. Output remains bounded to 2 MB.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

JSON document
{"name":"Ada","items":[{"id":9007199254740993,"active":true},{"id":2,"active":false}],"settings":{"theme":"blue"}}
Merge Patch document
{"settings":{"theme":"violet"},"name":null}

Example result

{
  "items": [
    {
      "id": 9007199254740993,
      "active": true
    },
    {
      "id": 2,
      "active": false
    }
  ],
  "settings": {
    "theme": "violet"
  }
}

RFC 7396: object null members delete keys; non-object patches replace the whole target.