JSON Patch Diff screenshot

JSON Patch Diff

Compare two JSON documents and emit an RFC 6902 patch: replace, add and remove operations with JSON Pointer paths.

Privacy First
0 Runs
Updated 2026-11-17
Runs in your browser
No sign-up, no upload

What the JSON Patch Diff does

Objects recurse, so a change three levels down is one operation at that exact pointer rather than a replace of the whole document. Keys that contain a slash or a tilde are escaped the way the specification requires (~1 and ~0).

Arrays are compared as one value: a changed array is a single replace at the array's path. That is deliberate — an element-wise diff needs a move/remove algorithm whose result is ambiguous, and this page will not invent one.

Arrays are replaced whole, not diffed element by element. The patch is a snapshot against the document you pasted, not a merge; apply it to that document and nothing else.

How to use it

Paste the first document into the Left JSON box and the second into the Right JSON box.

Press Run and read the JSON Patch below: each operation names its path and, for a replace or an add, the value it writes.

Check an unchanged key in the JSON Patch — it appears in no operation, which is what makes the patch safe to apply.

Worked example

Input:

{"name":"Ada","age":36}

Output:

[
  {
    "op": "replace",
    "path": "/name",
    "value": "Ada Lovelace"
  },
  {
    "op": "add",
    "path": "/tags",
    "value": [
      "math"
    ]
  }
]

Why it runs in your browser

The result is produced on this page with JavaScript, so it works offline after the page loads and nothing you enter is sent anywhere.

A patch you can hand to any RFC 6902 implementation: one operation per changed property, with the pointer path written out.

Two objects are walked key by key; an added key is an add, a missing key is a remove, and a changed value is a replace at its own path.

What it does, and what it does not

Objects recurse, so a change three levels down is one operation at that exact pointer rather than a replace of the whole document. Keys that contain a slash or a tilde are escaped the way the specification requires (`~1` and `~0`).

Arrays are compared as one value: a changed array is a single replace at the array's path. That is deliberate — an element-wise diff needs a move/remove algorithm whose result is ambiguous, and this page will not invent one.

Arrays are replaced whole, not diffed element by element. The patch is a snapshot against the document you pasted, not a merge; apply it to that document and nothing else.

How to use JSON Patch Diff

Paste the first document into the Left JSON box and the second into the Right JSON box.

Press Run and read the JSON Patch below: each operation names its path and, for a replace or an add, the value it writes.

Check an unchanged key in the JSON Patch — it appears in no operation, which is what makes the patch safe to apply.

What to Expect

Best for

  • Recording what changed between two API responses
  • Producing a patch a library can apply

Not ideal for

  • Diffing a long array element by element
  • Merging two documents, which this page does not do

What this tool keeps

  • One operation per changed object key
  • Pointer escaping for a key with a slash or tilde

What may need cleanup

  • An array change is one replace, so the patch is larger than it needs to be
  • A move between two keys is an add plus a remove

Common errors

  • The page refuses it: the left document is not JSON

Example use cases

  • Comparing two versions of a config file
  • Building a patch for a JSON Patch endpoint

Sample input

Left JSON: {"name":"Ada","age":36}

Sample output

JSON Patch: [ …

Who this is for

  • Developers integrating a PATCH endpoint
  • Anyone reviewing what a config change touched

Frequently asked questions

Why is a changed array one operation?

An element-wise array diff has to choose between replace, move and remove for the same result, and different tools choose differently. One replace at the array's path is unambiguous.

Does it need both documents to be objects?

No. Any JSON value works; two objects are walked key by key, and anything else becomes a replace at its own pointer.

Is the patch reversible?

Not by itself. The page emits forward operations only; a reverse patch is the same comparison with the documents swapped.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.