About this JSON comparison
API responses, configuration files and test fixtures are usually JSON, and the interesting change is often one value deep inside a nested object. A JSON diff puts the two documents next to each other and points straight at the keys whose values differ.
When one side is minified or indented differently, use Format JSON to pretty-print both sides with the same two-space indentation before comparing. You can undo it with one click.
What changed in this sample
- Top-level
idandagechanged, and bothlocationandaddressmoved from Boston, MA to Los Angeles, CA. - One item in the
interestsarray stayed the same while two were replaced. - The job title, company and location in the nested
jobobject all changed. - Each friend in the
friendsarray got a new id, age and city, and the education block changed degree and year.
Tips for comparing JSON
- Format both sides first
- Format JSON appears in the toolbar when the syntax is JSON. It makes the indentation identical, so only real data changes remain.
- See single-digit changes
- IDs and numbers often differ by one character. Set the inline highlight to Characters under More to mark just the digits that changed.
- Compare API responses
- Copy the response body from your browser’s network panel or from curl into each side. Large responses up to 10 MB can be opened as files.
- Watch for reordered keys
- JSON objects have no key order, but this comparison is textual. If two objects only differ in key order, format both, then try Sort lines before comparing to confirm.
How to compare JSON online
- Paste the older version into Original and the newer one into Changed, or open a file on each side.
- Check that the syntax menu says JSON, then pick split or unified view.
- Step through the changes with the arrows or Alt ↓, and use Settings for options such as ignoring blank lines.
- Save the comparison in your browser, share a link, or download it as a .diff, HTML or PDF.
JSON comparison: questions
How do I compare two JSON objects?
Paste one object into each pane, set the syntax to JSON if it is not detected, and press Format JSON. Every key whose value differs is highlighted, including inside nested objects and arrays.
Does it validate the JSON?
Format JSON parses both sides and tells you which side is not valid JSON. The comparison itself works on any text, so invalid JSON can still be compared.
Does key order matter?
The comparison is line based, so a key that moved shows as removed in one place and added in another. Sorting lines before comparing helps check whether two flat objects contain the same keys and values.