The short version
- Paste both versionsPut the original JSON on the left and the changed JSON on the right.
- Check for the validation warningIf a side is not valid JSON, a warning shows the parser's message. Fix it before trusting the diff.
- Format both sidesUse Format so that both documents use the same indentation and every value sits on its own line.
- Sort the keysUse Sort keys when the two files list the same keys in a different order.
- Read the highlighted linesRemoved lines are marked on the left, added lines on the right, and changed values are highlighted inside the line.
Two JSON files can mean the same thing and still look completely different: one is minified, the other is indented, the keys are in another order, or a trailing comma slipped in. A plain text comparison treats all of that as change. This guide shows how to get to the differences that matter.
Before you compare: make sure both sides are valid
A diff is only meaningful if both documents are well-formed. Paste each version into the editor and watch for the validation warning. It shows the parser's own message, which usually points to the exact problem, such as a missing comma or a stray quote.
Common causes of invalid JSON:
- a trailing comma after the last item in an object or array
- single quotes instead of double quotes
- unquoted keys
- comments, which JSON does not allow
Step 1: format both sides
Minified JSON is a single long line, so any change makes the whole line different. Use Format on each side. Every key and value now sits on its own line, and a diff can point at the one value that changed instead of the whole document.
Step 2: sort the keys if the order differs
Many tools write keys in an order that depends on how the data was built. Two exports of the same record can list the keys differently, and a line-by-line diff reports each moved key as a removal plus an addition. Use Sort keys on both sides so that both documents list keys alphabetically, including keys inside nested objects.
Arrays are different. The order of items in an array usually means something, so sorting keys does not reorder arrays, and a reordered array will still show as a change.
Step 3: read the result
With both sides formatted and sorted:
- a line marked on the left only was removed
- a line marked on the right only was added
- a line that appears on both sides with a highlighted part inside it had a value changed
Step 4: tune the comparison
If the same value appears with different spacing, switch on Ignore whitespace. If you are comparing data where capitalisation does not matter, switch on Ignore case. Use Swap to flip the two sides when you pasted them the wrong way round.
When to use something else
For very large files, or when you need to compare data structurally (treating {"a":1,"b":2} and {"b":2,"a":1} as identical without sorting), a dedicated JSON-aware tool may suit you better. For everyday checks, such as comparing two API responses or two config files, format, sort and compare is quick and reliable.
Questions
Does the order of keys matter when comparing JSON?
To a JSON parser, no: an object is an unordered set of keys. To a line-by-line diff, yes, because a moved key looks like a deletion and an addition. Sorting the keys on both sides removes that noise.
Is my JSON uploaded when I compare it?
No. The comparison runs in your browser, so the text you paste stays on your device.
Why does the diff show every line as changed?
Usually because one file is minified (all on one line) and the other is indented. Format both sides first and the real differences will stand out.