How to Compare Two JSON Files Reliably
Updated November 2026
Two JSON files can hold identical data yet look completely different as text. Comparing them reliably takes a little preparation.
Why raw diffs mislead
Indentation, line breaks and key order are not part of the data, but a text diff flags them anyway. One minified file against one pretty-printed file shows every line as changed.
Three steps
- Format both files the same way with the JSON Formatter, using the same indentation.
- Check key order. Objects are unordered in JSON, so if your tool does not sort keys, a moved key will show as a change even though the data is equal. Arrays, however, are ordered, so a moved item is a real change.
- Compare in Text Compare, and tick Ignore whitespace if only spacing differs.
Reading the result
Added lines mean new keys or items; removed lines mean deleted ones. A removed line next to an added line with the same key usually means the value changed. Typical uses: checking an API response before and after a release, or reviewing a config change.