Skip to main content

JSON Diff

See exactly what changed between two documents.

A text diff of two JSON files is noisy: reorder a few keys or reformat the file and every line looks changed. Jsonviewpro compares the parsed structures instead, so you get a list of real differences — each with the JSON path you can use to find it.

Before

Size: 0 BLines: 0

After

Size: 0 BLines: 0

What is a structural JSON diff?

A structural diff parses both documents and walks them together, comparing values by path rather than by line. Whitespace, indentation and key order are irrelevant, so the result contains only differences that would matter to a program consuming the data.

How to compare two JSON files

  • Paste the original document into the Before panel and the new one into After — or drop a file onto either panel.
  • Press Compare JSON.
  • The summary shows how many fields were added, removed, changed or changed type.
  • Work through the change list; each entry shows the path, the old value and the new value. Use Previous / Next to step through them.

How array changes are detected

Arrays are the hard part of any structural diff, because an item inserted at the front shifts every index after it. Jsonviewpro picks the best available strategy automatically:

  • If array items are objects sharing a unique identifier field (id, _id, uuid, key, slug, code, sku or name), items are matched by that identifier — so an insertion does not report every later item as changed.
  • Otherwise, for arrays up to a few hundred items, a longest-common-subsequence alignment finds genuine insertions and removals.
  • For very large arrays, items are compared by index, which keeps memory predictable.

Reading the change types

  • Added — the path exists only in the After document.
  • Removed — the path exists only in the Before document.
  • Changed — the same path holds a different value of the same type.
  • Type changed — the same path holds a different JSON type, for example the number 10 becoming the string "10". These are worth reviewing first; they are a frequent source of production bugs.

Frequently asked questions

Does key order affect the diff?
No. JSON object keys are unordered, so Jsonviewpro compares by path. Reordering keys produces no differences.
Can I compare two files instead of pasting?
Yes. Drop a .json file onto either panel, or use the upload button on that panel.
Why is a whole array reported as changed?
That happens when items have no stable identifier and the array is too large for subsequence alignment. Adding an id field to your records, or comparing a smaller slice, gives a much more precise result.
Are both documents kept private?
Yes. Both are parsed and compared in your browser; neither is uploaded.