JSON
How to compare two JSON files without uploading them
To compare two JSON files without uploading them, use a diff tool that parses and compares the JSON entirely inside your browser tab, such as JSON Mirror, or compare them offline with jq or a few lines of Python. Either way the documents never leave your machine, which matters when they contain API keys, customer records or internal configuration.
Why you shouldn't paste sensitive JSON into any online diff site
The JSON people need to compare is rarely harmless. It is usually one of these:
- Configuration files that contain database URLs, API keys, OAuth client secrets or feature flags you have not announced.
- API responses that include access tokens, session IDs, or internal identifiers.
- Customer data such as names, emails, addresses and order histories: personal data that your privacy policy, contracts or regulations may restrict.
Many hosted "JSON diff online" tools send what you paste to a server, either to compute the diff or to create a shareable link. Once the data is on someone else's server, you cannot see whether it is logged, cached, indexed or kept. For a secret, the safe assumption is that it has been exposed and must be rotated. For personal data, pasting it into an unvetted third-party service may break your organisation's data-handling rules even if nothing bad ever happens to it.
The fix is simple: only use a comparison method where the JSON stays on your device. There are three practical options, described below.
How to compare two JSON documents in your browser, step by step
JSON Mirror is a free JSON diff that runs entirely in the browser tab. There is no account and no install, it makes no network requests while you work, and it uses no analytics, cookies or browser storage. Close the tab and the data is gone.
1. Paste the two documents
Paste the older version into Original and the newer one into Updated. To follow along, press Load example, which fills in these two documents:
{"project":"JSON Mirror","version":"1.0","settings":{"theme":"light","notifications":true},"members":["Alex","Sam"],"status":"draft"}
{"project":"JSON Mirror","version":"1.1","settings":{"theme":"dark","notifications":true},"members":["Alex","Sam","Jordan"],"published":true}
If a document is minified, the Format button pretty-prints that editor. Swap exchanges the two inputs if you pasted them the wrong way round.
2. Press Compare JSON
Click Compare JSON or press Ctrl+Enter (Cmd+Enter on a Mac). JSON Mirror parses both documents and compares their structure, not their text, so whitespace and object key order are ignored. (For why that is the right default, see why key order and whitespace shouldn't show up in a JSON diff.) The example produces five changes:
| Kind | Path | Original | Updated |
|---|---|---|---|
| changed | $.version | "1.0" | "1.1" |
| changed | $.settings.theme | "light" | "dark" |
| added | $.members[2] | (none) | "Jordan" |
| removed | $.status | "draft" | (none) |
| added | $.published | (none) | true |
Each entry also carries a one-line plain-English explanation and shows the original and updated values side by side.
3. Filter the results
Use the All / Changed / Added / Removed filter to focus. In the example, Changed shows the two edited values, Added shows the new array item and the new published key, and Removed shows only $.status. The screen lists the first 300 entries per filter.
4. Read the paths
Every path starts at $, the root of the document. Simple keys use dot notation ($.settings.theme), array positions use brackets ($.members[2] is the third item), and unusual keys use quoted brackets, such as $["first name"]. The guide to reading JSON paths in a diff covers the details.
5. Export the report
Export report downloads a JSON report with every entry, not just the first 300, generated in the browser and saved to your machine. If you edit either input after comparing, the results are marked stale and export is disabled until you compare again, so a report always matches the inputs it came from. For what the file contains, see how to export JSON differences beyond the 300-result view.
Know the limits
Arrays are compared by index, so inserting an item near the start shows up as several "changed" entries plus one "added" entry; moves are not detected (see comparing JSON arrays by position or by identity). Numbers are parsed with the standard JavaScript JSON.parse, so integers larger than 9,007,199,254,740,991 can lose precision. Each input is limited to 1,000,000 characters, and nesting deeper than 120 levels is rejected.
How to compare JSON files offline with jq
If you already have jq installed, this one-liner works in bash and zsh:
diff <(jq -S . a.json) <(jq -S . b.json)
jq . pretty-prints each file with consistent indentation, and -S sorts the keys of every object. That normalises both files, so differences in key order and whitespace disappear. diff then compares the two normalised outputs line by line.
Keep in mind that this is still a text diff of the normalised output. It tells you which lines differ, not which JSON paths, and a change deep in a large file is shown with line numbers rather than $.settings.theme. Array order is preserved, so reordered arrays still show up as changes. For a quick check in a terminal or a CI job, it is hard to beat.
How to check whether two JSON files are equal in Python
When you only need a yes or no, Python's standard library is enough:
import json
with open("a.json") as f:
a = json.load(f)
with open("b.json") as f:
b = json.load(f)
print("equal" if a == b else "different")
Dictionary comparison ignores key order and list comparison respects position, so == gives the same answer as a structural diff. Python also parses JSON integers exactly, so large IDs compare correctly. What it does not tell you is where the documents differ. For that you would need to write a recursive walk, or use one of the tools above.
Which method should you use?
| Method | Best for | Output | Trade-off |
|---|---|---|---|
| JSON Mirror (browser) | Reviewing changes, sharing a report, no tools installed | Kind, path, explanation and values per change | Index-based arrays; large integers may lose precision |
jq -S + diff | Terminals, scripts, CI | Line-based text diff | No JSON paths; needs jq and a shell with process substitution |
Python == | Automated equality checks, exact big integers | Equal or different | Does not say where the difference is |
Checklist: how to tell if a JSON diff tool is really local
"Private" and "secure" on a landing page are claims, not proof. You can check a browser-based tool yourself in a couple of minutes, using dummy data first:
- Watch the Network tab. Open DevTools (F12), go to the Network tab, clear it, then paste and compare. A local tool makes no new requests when you compare.
- Go offline. Load the page, disconnect from the network, and run a comparison. If it still works, the diff is computed on your device.
- Look for share links. A "share" or "save" button that produces a URL to your diff usually means your input is stored on a server.
- Check for accounts and trackers. A tool that requires sign-in, or loads analytics and advertising scripts, has more places for data to go.
- Read the privacy statement. It should say plainly that input is not uploaded, and that should match what you saw in steps 1 and 2.
Try it
The safest way to compare two JSON files is one where the data never leaves your machine. For a readable, path-by-path report, open JSON Mirror, press Load example, and compare. For scripts and CI, reach for jq -S with diff, or a Python equality check when you only need to know whether anything changed.
Frequently asked questions
Is it safe to paste JSON into an online diff tool?
Only if the tool processes the JSON in your browser and sends nothing to a server. If you cannot verify that, treat anything you paste as shared with a third party and keep secrets, tokens and personal data out of it.
How do I compare two JSON files offline from the command line?
Run diff <(jq -S . a.json) <(jq -S . b.json) in bash or zsh. jq pretty-prints both files with object keys sorted, so the line diff ignores key order and formatting, though it still reports lines rather than JSON paths.
Does key order matter when comparing two JSON objects?
No. JSON objects are unordered collections of name/value pairs, so {"a":1,"b":2} and {"b":2,"a":1} hold the same data. A structural JSON diff, jq -S, and Python's dict comparison all treat them as equal.
How can I check that a JSON diff website does not upload my data?
Open your browser's DevTools Network tab, clear it, and run a comparison: a local tool makes no new requests. You can also load the page, go offline, and confirm the comparison still works.
Can a browser-based JSON diff compare very large integers exactly?
Not if it uses the standard JavaScript JSON.parse, which stores numbers as 64-bit doubles. Integers above 9,007,199,254,740,991 can lose precision, so use Python, which parses JSON integers exactly, for that case.