Compare Two JSON Objects
The reliable way to diff JSON is to normalise both sides first. Pretty-print each object in the tool below, then compare the two clean outputs line by line so only real differences show up.
Why raw diffs lie
Two JSON files can be identical in meaning but differ in whitespace, key order, or indentation. A plain text diff flags all of that as changes. Object key order is not significant in JSON, so a good comparison ignores it.
Normalise, then diff
Pretty-print both documents with the same indentation and, ideally, sort keys the same way. Now a line diff shows only meaningful changes: a value that moved, a key that was added or removed, an element inserted into an array.
Arrays are order-sensitive
Unlike object keys, array order is significant: [1, 2] and [2, 1] are different values. If your arrays are really unordered sets, sort them the same way on both sides before comparing.
FAQ
Does key order count as a difference?
No. JSON objects are unordered, so reordered keys represent the same data. Sort keys on both sides to remove that noise before diffing.
How do I compare arrays fairly?
Array order matters in JSON. If your array is conceptually a set, sort both arrays with the same rule first, then compare.
What is the fastest manual method?
Pretty-print both objects with identical settings, then paste them into any side-by-side text diff — the formatting will match, so only real changes remain.