JSON Diff

Converter

Compare two JSON documents and highlight deep differences with an inline view for spotting API response changes and configuration drift issues. Copy the report.

+ 1 added− 1 removed~ 1 changed
ALeft (A)
BRight (B)
Aligned comparison
A
{
"name": "Alice"
~ "age": 30
"tags": [
"admin"
− "user"
]
}
B
{
"name": "Alice"
~ "age": 31
"tags": [
"admin"
]
+ "email": "a@x.com"
}

About JSON Diff

Comparing two JSON documents by eye (e.g. an API before/after a change, or old/new config) makes it easy to miss differences. This tool does a structural diff of two JSON inputs locally in your browser, ignoring key order and formatting, and precisely marks added, removed, and changed fields. Nothing is uploaded — safe for production configs. For example, diffing {"name":"A","age":1} against {"name":"B","age":1} highlights only the name change, ignoring the identical age.

Structural and textual comparison answer different questions: one asks whether the data is the same, the other whether the file changed. Textual comparison goes line by line and catches whitespace and key order changes that may be semantically irrelevant, while structural comparison ignores order and formatting and reports only value-level additions, removals and edits. Use structural comparison to check meaning.

Array handling is what needs agreeing first, since an array may be ordered or not. If the array carries meaningful order, such as a list of steps, a position change is a real edit; if it is merely a set, such as a list of tags, a position change is not. Confirm each array semantics before comparing and sort by some key where needed rather than always matching by position.

Key order and formatting differences generate noise that hides real changes, the biggest practical pain point. The same data processed by different tools may reorder keys and indent differently, and a line-by-line comparison then reports many changes. Normalise key order and formatting before comparing, so the difference list focuses on genuine edits.

How the differences are presented decides usability, especially with long arrays. Listing item by item marks every later item as changed once one is inserted at the front, turning a single insertion into dozens of differences. Detect insertions and deletions first and present shifts afterwards, or offer similarity matching, so the reviewer sees the real changes.

When differences feed a merge or a patch, the semantics must be explicit rather than mechanically substituted. A merge may overwrite a field, append to an array or remove a whole subtree, and without agreement the outcome is unpredictable. If the difference drives an automatic merge, use a form with defined patch semantics and validate on a copy before applying.

Finally, differences exist to support human judgement, so readability and locatability matter more to efficiency than precision. The list should point at the exact path, several levels deep, and show the values before and after; a wall of text or a bare report of any difference leaves the user searching by hand. Presentation often outweighs detection breadth.

How It Works Internally

Comparison parses both documents into trees and walks them level by level, which lets it separate "the key order changed" from "the value changed" — the first has no semantic effect. Arrays are the hard case: comparing by position reports one insertion as "everything after changed", while comparing by content may call a reorder no change. Both are useful, and the report should say which is in use.

Input{"a":1,"b":2} vs {"b":2,"a":1}
OutputNo differences (reordered keys have no semantic effect)

Measured on This Page

Value and keya 1→2 plus the new key d both reported, paths a and d correct
Array by indext:[x,y] → t:[x] reports t[1] removed — arrays compare positionally, not by value
Type change1 → "1" is a change, not equality — differing types always differ
IdenticalZero diffs, no false positives
Path syntaxDots for objects, brackets for arrays: t[1].name and a.b.c can be followed straight to the value

Array semantics are the most misunderstood part of JSON diffing: this page compares index by index, so inserting 1 element at the head marks every following element (2nd, 3rd, …) as changed — not a bug, but the difference between positional and identity-based comparison. Matching by identity (say, an id field) needs a separate implementation. Another practical tip: normalise key order before comparing, though this page compares parsed objects by key set, so original text order does not matter — which is the correct behaviour.

How this was measured: Four JSON pairs (value change plus added key / array element removal / type change / identical) compared entry by entry against an independent Python recursive diff, with paths verified in the list view. · Measured 2026-10-31

How to Use

  1. Open "JSON Diff"
  2. Put the original JSON on the left, the new one on the right
  3. Changes are marked as you type
  4. Switch between split and list views
  5. Click "Swap" to reverse the comparison

Use Cases

  • API regression — Compare responses before and after an API upgrade to confirm field changes are expected.
  • Config audit — Compare config JSON across two environments (staging/prod) to find inconsistencies.
  • Debug regressions — Compare data snapshots from normal and faulty cases to pinpoint differing fields.
  • Version comparison — See the actual changes in package.json and similar configs between two git revisions.
  • Data validation — Verify that JSON before and after processing changed only in expected fields.
  • Schema migration — Compare JSON output after a schema change to confirm only expected fields were added or removed.
  • Merge conflict — Paste the two sides of a JSON merge conflict to see exactly which keys differ.

FAQ

Does it ignore key order?

Yes. JSON object keys are inherently unordered, so the tool compares by key name, not position — different order is not flagged as a difference.

How are arrays compared?

Arrays are compared item by item by index. Reordered array elements may be flagged as differences because JSON arrays are ordered.

Can it compare deeply nested JSON?

Yes. It recursively compares nesting of any depth and reports difference paths down to the leaf node.

Does formatting affect the result?

No. Indentation and whitespace differences are ignored — only actual data content is compared.

What if one JSON is invalid?

The tool validates both inputs first; syntax errors are reported and must be fixed before comparing.

Can I ignore array element order?

By default arrays are compared element-by-element by index, so reordered elements show as differences. For unordered sets (like tag lists), sort them first before diffing.

Why is 1 vs "1" reported as a difference?

In JSON, a number and a string are different value types: the number 1 is of type number while "1" is a string. The tool compares by type plus value, so 1 vs "1", true vs "true", and null vs "" are all treated as different. This usually happens when an API returns a numeric field as a quoted string, or when environments serialize types inconsistently. If you want to compare literal content only and ignore type, normalize the type on one side first, then re-diff or confirm the expected value manually.

Do array order changes count as differences?

Yes — JSON arrays are ordered, so position changes are structural. If you only care about the content set (tag lists, ID sets), enable "ignore array order" and the tool sorts both sides first to cut noise.