JSON Diff and Patch

Compare JSON and download the generated changes or patch for independent review.

On-device No sign-up Free to use

Compare JSON controls

Showing an example. Edit to see your own.

?

The document before the changes.

?

The document after the changes.

Indentation

Processed in your browser. Your inputs stay on this device.

Result

Showing an example.

Generate and check an add/replace patch for a changed name, extra role and null active value.

Found 3 changes: 1 added, 0 removed, 2 replaced. Apply the patch to the original JSON to get the updated document.

Loading the tool. Your result will appear here.

https://usefreetools.net/json-diff-patch · 20 November 2026

Was this helpful?

How to use JSON Diff and Patch

  1. Paste the document you have now into Original JSON and the document you want into Updated JSON.
  2. Pick how the patch should be indented. Compact output is a single line; 2 or 4 spaces are easier to read.
  3. The changes and patch update as you edit either JSON document. Review the operations before applying the patch to the original document.

Example: JSON Diff and Patch

Generate and check an add/replace patch for a changed name, extra role and null active value.

You add
Original JSON: { "name": "Ada", "roles": ["admin"], "active": true }; Updated JSON: { "name": "Ada Lovelace", "roles": ["admin", "editor"], "active": null }; Indentation: 2
You get
Found 3 changes: 1 added, 0 removed, 2 replaced. Apply the patch to the original JSON to get the updated document.

Options

Original JSON
The document before the changes.
Updated JSON
The document after the changes.
Indentation
Compact writes the patch on one line; two or four spaces expand it for review. Indentation changes the output layout, not the generated operations.

Supported inputs and limits

  • Both documents are read as text, up to 200,000 characters each, 64 levels of nesting and 200,000 values per document.
  • The diff is positional for arrays, so an insert in the middle shows as a run of replacements rather than one move; a move is not detected as a move.
  • Numbers are ordinary JavaScript doubles, so the tool refuses integers outside -9007199254740991 to 9007199254740991 and any value that parses to Infinity instead of changing it quietly.
  • A "__proto__" key is refused.
More details

Only add, remove and replace operations are produced; test, move and copy are not.

The table lists at most 500 operations and shortens long value previews.

The complete patch remains in the text output and changes.json download.

Array-order ignoring and an interactive colored tree diff are not provided.

Apply and check the patch against its intended original document.

Where your input is processed

This tool does not upload your inputs. See the limits for anything saved on your device.

Why the patch is built from structure, not lines

A line diff is useful when you read it, but it cannot be applied to a data structure. Json Patch names each value by a JSON Pointer, so an operation says exactly which key or index to change. That is why the tool compares values instead of text: the same document written with different spacing, key order or line breaks still compares as equal, and only real value changes appear in the patch.

Questions about JSON Diff and Patch

Why did adding one item in the middle change several lines of the patch?

The comparison works by position, the way JSON Patch indexes array members. Adding an item in the middle shifts everything after it, so each shifted value shows as a replace at its old index. The patch still rebuilds the updated document exactly.

Do whitespace, key order or array order affect the patch?

Formatting, key order and line breaks are ignored, because the comparison looks at values. Array order is part of the value, so two lists with the same entries in a different order still differ, and the patch reports that as a run of replaces. Move the entries into the same order first if the order does not matter to you.

What happens to very large integers and decimals?

Numbers use standard JavaScript doubles. The tool refuses integers outside ±9007199254740991 and values that parse to Infinity. Other decimals retain normal floating-point precision; a parsed value can already be rounded. Keep precision-sensitive identifiers or decimals as strings before comparing.

Is the patch checked before I copy it?

Yes. The tool applies the patch to the original document and compares the result with the updated document. If they differ, it reports that and returns nothing. Your two inputs stay in this browser.

Page updated · Project managed by Tony Hines · Report a problem with JSON Diff and Patch