Back

JSON diff and JSON Patch

Data conversion

Loading

Loading tool

Preparing the tool. The remaining time is not yet known.

All processing for this tool happens in your browser. Your input is not sent to a server.

About this tool

Compare the original JSON on the left with the target on the right. The difference table remains available alongside a JSON Patch that is applied locally and checked against the target before export.

Common uses

  • Review configuration changes and copy a path-level difference report.
  • Prepare an add/remove/replace patch for a known original JSON document.
  • Inspect changes to large integer identifiers without binary floating-point rounding.

How to use it

  1. 1.Paste strict JSON values into the separately labeled original and target fields.
  2. 2.Choose Compare and generate patch; use Cancel to terminate the worker.
  3. 3.Inspect the difference table and the complete verified patch. Page through long reports. Copy the report, copy the patch or download the patch only while the result is current. Editing either input clears it.

Verified source-to-target examples

Change a name

Original: {"name":"Ada"}
Target: {"name":"Grace"}
[{"op":"replace","path":"/name","value":"Grace"}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Add a property

Original: {}
Target: {"active":true}
[{"op":"add","path":"/active","value":true}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Remove a property

Original: {"old":null}
Target: {}
[{"op":"remove","path":"/old"}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Remove array tails in reverse order

Original: [1,2,3]
Target: [1]
[{"op":"remove","path":"/2"},{"op":"remove","path":"/1"}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Append in order

Original: [1]
Target: [1,2,3]
[{"op":"add","path":"/1","value":2},{"op":"add","path":"/2","value":3}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Escape slash and tilde

Original: {"a/b":{"~key":1}}
Target: {"a/b":{"~key":2}}
[{"op":"replace","path":"/a~1b/~0key","value":2}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

An empty property name is not the root

Original: {"":1}
Target: {"":2}
[{"op":"replace","path":"/","value":2}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Replace the root value

Original: null
Target: [true]
[{"op":"replace","path":"","value":[true]}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Preserve a large integer

Original: 9007199254740992
Target: 9007199254740993
[{"op":"replace","path":"","value":9007199254740993}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Exact numeric equality ignores spelling

Original: {"n":1.00,"z":-0}
Target: {"z":0,"n":1e0}
[]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Treat special keys as data

Original: {}
Target: {"__proto__":{"safe":true}}
[{"op":"add","path":"/__proto__","value":{"safe":true}}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Preserve Unicode characters

Original: {"emoji":"猫"}
Target: {"emoji":"😀"}
[{"op":"replace","path":"/emoji","value":"😀"}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Compare by index, not identity

Original: ["a","b"]
Target: ["b"]
[{"op":"replace","path":"/0","value":"b"},{"op":"remove","path":"/1"}]

Apply this complete patch to the left JSON value to obtain a value equivalent to the right. Operation order is significant.

Input and export checks

  • Duplicate decoded keys, comments, trailing commas and a leading BOM are rejected rather than silently repaired.
  • An empty pointer is the root; / targets an empty object key. ~1 decodes to / and ~0 to ~.
  • Do not apply this patch after the original document changes. There are no test preconditions.
  • Input edits, language changes, cancellation and navigation invalidate old results and export feedback.

Limits and notes

  • Each input: 200,000 UTF-8 bytes, 64 container levels and 20,000 values. At most 2,000 operations, 500,000 bytes of combined patch/report data and 5 seconds per run.
  • Exact decimal comparison; patch values retain numeric spelling. Numbers: at most 256 characters and an absolute exponent of 10,000. Duplicate keys and unpaired Unicode surrogates are rejected.
  • Arrays compare by index, not identity. Only add/remove/replace are generated; this is not a minimal patch or a general patch importer. Object order, whitespace and numerically equal spellings are ignored.
  • Apply only to the exact original value. No precondition test operations are included. Downstream parsers may lose numeric precision or reject special keys. Review before using.
  • The table shows 50 changes per page and at most 400 UTF-16 code units per value. Copy report includes full values; patch export is complete. Display paths use $ notation; the patch uses JSON Pointer.

Frequently asked questions

Does the patch reproduce the exact target text?

It reproduces an equivalent JSON value. Whitespace, object member order, escape spelling and numerically equal spellings such as 1.00 and 1e0 are not changes. Array order and string code points do matter.

Can I import any JSON Patch?

No. This tool generates and internally verifies add/remove/replace only. It does not import patches or emit move/copy/test, and does not promise the fewest operations.

Are special keys safe?

Keys such as __proto__, constructor and prototype are handled as ordinary Map entries, never assigned onto JavaScript prototypes. External patch libraries may reject these keys; check your destination.

What numeric precision is preserved?

Numbers are compared as exact decimals within the stated length and exponent bounds. Changed values retain target number tokens in the exported patch. A downstream binary64 parser can still round them.

Related tools