JSON tools

JSON Diff: Compare Two JSON Documents

Compare two JSON documents value by value and get a clear list of what was added, removed or changed, with paths you can paste into code.

  • Free foreverNo trial, no paywall, no usage limits.
  • No sign-upOpen the page and start. We never ask for an email to use a tool.
  • PrivateEverything runs in your browser. Your input is never uploaded or stored on our servers.
  • Works offlineOnce the page has loaded, the tool keeps working without a connection.
Swap A and B, so additions become removals and the other way round.
JSON objects are unordered, so {"a":1,"b":2} equals {"b":2,"a":1}. Turn off to also flag keys that moved.
Compare arrays as unordered collections. Use it for tags, permissions or IDs where order carries no meaning.
Treat numbers as equal when they differ by no more than this amount. Handy for floats from different runtimes (0.1 + 0.2).

Original (A)

The before version: an old API response, last release's config…
Clear

Modified (B)

The after version to compare against A.
Clear

Differences

Each change is listed with its path. Click one to jump to it: added values in B, everything else in A.

Paste two JSON documents to compare

Values are compared, not text: whitespace and formatting never show up as changes. Comments and trailing commas are accepted.

Need this built into your own API or pipeline? Talk to our team

Quick answer

A JSON diff compares two documents by their data rather than their text, so formatting and key order never show up as changes. Paste the original and the new version side by side into Playxoft's free JSON Diff tool: every difference is listed with its path and marked as added, removed, changed or type changed. You can ignore array order, allow a numeric tolerance and export an RFC 6902 JSON Patch.

  • Structural comparison
  • Added, removed and changed
  • Path for every change
  • Ignore key or array order
  • Numeric tolerance
  • JSON Patch export
  • Click to jump

How to use the JSON Diff

  1. 1Paste the original JSON into Original (A) and the new version into Modified (B), or drop a file onto each.
  2. 2Keep Ignore key order on unless the order of keys matters to you.
  3. 3Turn on Ignore array order for lists that are really sets, and Numeric tolerance to ignore floating-point noise.
  4. 4Click a summary chip to filter by Added, Removed, Changed or Type changed, and click any row to jump to it.
  5. 5Copy the plain-text report, or Copy JSON Patch to apply the same change in code.

Why not use a text diff for JSON?

Line-based tools like git diff compare characters, not data. Re-indenting a file, reordering keys or minifying it produces a wall of red and green even though nothing meaningful changed, while a real change buried in a long line is easy to miss.

A structural diff parses both documents first and compares values. Formatting is irrelevant, 1.0 equals 1, and each change is reported once, with the path to it:

~ $.version: "1.8.2" → "1.9.0"
~ $.replicas: 3 → "3"            (type changed: number → string)
- $.timeoutMs: 2500
+ $.owners[2]: {"id": 3, "name": "Grace", "role": "dev"}

Paths use JSONPath-style notation: $ is the root, .name is a key and [2] is an array index. Keys that aren't plain identifiers are written in brackets, as in $["first name"]. Click any change in the list to jump to it in the editor.

How are changes inside arrays matched up?

Arrays are where naive diff tools fall apart. Compare items index by index, and inserting one element at the top makes every later index look changed.

This tool aligns arrays with a longest-common-subsequence pass, the same idea behind diff itself, so an insertion reads as one addition and a deletion as one removal. Items that were edited rather than added or removed are then paired up: objects that share an id, _id, uuid, key or slug value are matched first, then the most similar remaining objects.

The result reads the way you would describe it to a colleague: "Alan's role changed and Grace was added", not "owners 1 to 40 differ". Integers beyond 2^53 are compared digit for digit, so two IDs that JavaScript would round to the same number are still reported as different.

Does key order or array order matter in JSON?

Key order doesn't. RFC 8259 defines an object as an unordered collection of name/value pairs, so {"a": 1, "b": 2} and {"b": 2, "a": 1} are the same data, and Ignore key order is on by default. Turn it off when order matters to you, for example in a hand-maintained config file, and moved keys are listed as reordered.

Array order does matter: [1, 2] and [2, 1] are different values. But many arrays are really sets, such as tags, roles, permissions and feature flags. Ignore array order compares those as unordered collections, so only items that were genuinely added or removed are reported.

OptionUse it when
Ignore key order (on by default)Almost always
Ignore array orderArrays are sets: tags, IDs, permissions
Numeric toleranceFloats come from different runtimes or rounding

What is a JSON Patch?

JSON Patch (RFC 6902) is a standard format for describing changes to a JSON document as a list of operations. Each operation names its target with a JSON Pointer (RFC 6901), where / separates segments, ~1 stands for a slash inside a key and ~0 for a tilde:

[
  { "op": "replace", "path": "/version", "value": "1.9.0" },
  { "op": "remove", "path": "/timeoutMs" },
  { "op": "add", "path": "/owners/2", "value": { "id": 3, "name": "Grace" } }
]

Copy JSON Patch produces a patch that turns A into B, ordered so that every array index is valid at the moment its operation runs. Apply it with fast-json-patch in JavaScript or jsonpatch in Python, or send it as an HTTP PATCH body with the application/json-patch+json media type.

The simpler JSON Merge Patch (RFC 7396) sends a partial document instead. It is easier to read, but it can't set a value to null (null means delete) or change a single array element.

How do I diff JSON on the command line or in code?

Normalize both files with jq, then use an ordinary diff. Sorting keys with -S removes key-order noise:

diff <(jq -S . a.json) <(jq -S . b.json)

In code, fast-json-patch (JavaScript) and jsonpatch (Python) generate RFC 6902 patches from two documents, which also makes a precise assertion in API regression tests. For a quick visual check, paste both documents here: nothing is uploaded, so it is safe for production data. If one side won't parse, the JSON Validator lists every error in it.

Frequently asked questions

No. Both documents are parsed and compared by value, so indentation, line breaks and minification never appear as changes. Numbers are compared by value too, so 1.0 and 1 are equal.
Arrays are aligned with a longest-common-subsequence algorithm, so inserting or removing one item is reported as a single change. Edited objects are paired by a shared id, _id, uuid, key or slug, or by similarity, and then compared field by field.
The value at that path changed kind, for example from a number to a string, or from null to an object. These changes often break clients that expect the old type, so they are counted separately.
A JSON Patch must describe an exact, ordered change. It is disabled while Ignore array order or Numeric tolerance is on, because those options hide differences that the patch would need to include.
Yes. Files up to 5 MB open directly. The comparison runs in the background so typing stays smooth, and long change lists are shown a few hundred rows at a time.
No. Both documents are parsed and compared in your browser. Nothing is sent to a server or stored.

Last updated by the Playxoft engineering team.

From the engineers who built this tool

Fighting messy data every day?

When payloads, schemas and integrations keep breaking, the fix is usually upstream. We design typed APIs and backends that stay clean as you grow. Tell us what you are building and we will suggest the simplest architecture that fits.