/tools/json-diff

JSON Diff & Patch

Compare JSON values rather than formatting, search changes by pointer, and generate or apply a verified RFC 6902 patch.

Ready. Paste original and modified JSON, then compare locally.
Original JSON10 MiB
Modified JSON10 MiB

Semantic changes

RFC 6902 JSON Patch editable

Compare JSON arrays when item order changes

Use these as Original and Modified:

{"steps":["build","test"]}
{"steps":["test","build"]}

Compare and inspect changes at /steps/0 and /steps/1. JSON arrays are ordered, so swapping these steps changes the document. Object key order and indentation do not create semantic changes. Review the generated JSON Patch before applying it.

/compare

Semantic JSON diff instead of a text-only comparison

Whitespace and object property order do not create changes. Array order remains significant because an RFC 6902 patch addresses array members by index. Added, removed and replaced values are shown with copyable RFC 6901 JSON Pointer paths.

  1. Paste the original and modified JSON.
  2. Select Compare or press Ctrl/Command + Enter.
  3. Review the change list and generated patch.
  4. Copy or download the application/json-patch+json document.

Compare two JSON API responses

Paste the original response and the modified response below, then select Compare & generate patch. The modified object puts its keys in a different order and changes two values.

Original JSON:

{
  "service": "api",
  "enabled": false,
  "ports": [
    8080,
    8081
  ]
}

Modified JSON:

{
  "ports": [
    8080,
    9090
  ],
  "enabled": true,
  "service": "api"
}

The semantic changes are /enabled from false to true, and /ports/1 from 8081 to 9090. Reordering object keys does not create a change; array indexes still matter. Open the patch disclosure to review this generated RFC 6902 document:

[
  {
    "op": "replace",
    "path": "/enabled",
    "value": true
  },
  {
    "op": "replace",
    "path": "/ports/1",
    "value": 9090
  }
]

Applying this patch to the original reproduces the modified JSON value. The tool verifies that result before showing a generated patch. Use the change search to focus /ports/1; JSON Pointer indexes start at zero. If a document cannot be parsed, correct its syntax first. For changes to comments, formatting or other plain text, use Text Compare.

/patch

Generate and apply RFC 6902 JSON Patch

Generated patches use add, remove and replace. The Apply function also supports move, copy and test. Application is atomic: if any operation fails, no partial result replaces the modified input.

Verified output

Every generated patch is applied to a clone of the original and must reproduce the target before it is shown.

Bounded fallback

Highly divergent arrays degrade to a correct subtree replacement instead of unbounded edit-graph work.

/limits

Safe API and configuration debugging

Documents are processed in a disposable worker and never uploaded. Inputs are limited to 10 MiB and 250,000 values. Integers outside JavaScript's exact range are rejected rather than silently rounded; use Text Compare when lexical number preservation is the primary concern.

Is this JSON Merge Patch?

No. This page implements JSON Patch from RFC 6902. JSON Merge Patch has different null and array semantics and is not generated here.

/faq

JSON comparison questions

Does object key order count as a change?

No. Objects are compared by key and value; array position remains significant.

Can a failed patch partly change the document?

No. The patch is applied to a clone and the result appears only when every operation succeeds.