JSON Diff: Compare Two JSON Files
Paste an original and a changed JSON document and see exactly which keys were added, removed or changed, with the full path to each one. Key order and spacing are ignored. It runs in your browser, so your JSON is never uploaded.
JSON to compare
Differences
Paste JSON into both boxes to see what changed.
Options
How to compare two JSON documents
- Add both documents. Paste the original into box A and the changed version into box B, or drop a .json file on the page. Press Load sample to see an example.
- Read the result. Each line starts with + (added), - (removed) or ~ (changed) and shows the path, such as $.address.city. The list updates as you type, so there is no compare button.
- Tune the comparison. Ignore keys that always differ, such as updatedAt, or compare arrays without caring about their order.
The result is plain text. Copy it into a ticket or a pull request, or save it as a .txt file.
Before
A: {"name": "web", "replicas": 2, "debug": true}
B: {"name": "web", "replicas": 3, "tier": "pro"}After
- $.debug: true
~ $.replicas: 2 → 3
+ $.tier: "pro"How to read the result
Every line describes one difference. The symbol at the start tells you what happened to the value at that path.
| Symbol | Meaning | Example |
|---|---|---|
| + | The key or array item exists only in B (added). | + $.tier: "pro" |
| - | The key or array item exists only in A (removed). | - $.debug: true |
| ~ | The path exists in both, but the value or its type is different (changed). | ~ $.replicas: 2 → 3 |
The path starts with $, which is the top of the document. $.user.name is the name key inside user. $.items[2] is the third item of an array, because counting starts at 0. A key with spaces or symbols is written as $["first name"].
What this tool does
Most JSON diffs go wrong in one of three places: formatting noise, array order and big numbers. This one handles each on purpose.
- Private by design
- Both documents are parsed in your browser tab. Nothing is sent to a server, so it is safe for API responses and configuration that contain internal names or test data.
- Formatting and key order are ignored
- {"a": 1, "b": 2} and the same object written with the keys swapped and a different indent are equal. Only the data counts.
- Numbers are compared as written
- The parser keeps the text of each number. 12345678901234567890 and 12345678901234567891 are reported as different, which a tool that converts numbers to JavaScript values would not notice.
- Arrays are compared by position
- By default item 0 is compared with item 0, because order often matters in a list of steps or a sorted result. Turn on Ignore array order to match equal items wherever they sit.
- Number formatting is your choice
- 4.50 and 4.5 are different text. They are reported as a change unless you tick the option that treats them as the same number.
- Related tools
- Need to tidy or validate a document first? Use the JSON Formatter. Want the differences as a schema check? Try the JSON Schema tool.
When a JSON diff helps
A diff is the quickest way to answer "what changed?" when two versions of the same data look almost the same.
- API changes. Save a response before and after a deploy and compare them to see which fields appeared, vanished or changed type.
- Configuration drift. Compare the settings exported from staging and production to find the one value that differs.
- Test fixtures and snapshots. When a snapshot test fails, a path-level list is easier to read than a wall of red text.
- Webhook and vendor payloads. Check what a third party changed in its payload before your parser breaks.
- Data migrations. After converting or moving data, compare the source and the result to confirm nothing was lost.
A plain text diff flags every line when a file is reformatted or its keys are sorted, which hides the real change. A JSON-aware diff parses both sides first, so only differences in the data are shown.
Frequently asked questions
How do I compare two JSON files?
Paste the original JSON into box A and the changed JSON into box B, or drop a file on the page. The differences appear straight away as a list of added, removed and changed paths.
Does the order of keys matter?
No. Two objects with the same keys and values are equal whatever order the keys are written in, and whatever the spacing or indentation is.
How are arrays compared?
By position by default, so item 0 is compared with item 0 and so on. If the order of a list does not matter, tick Ignore array order and equal items are matched wherever they appear.
Is my JSON uploaded to a server?
No. Both documents are parsed and compared in your browser tab. Closing the tab discards them.
Why are 4.50 and 4.5 reported as different?
Because the tool compares numbers exactly as they are written. If you want them treated as the same value, tick the option for number formatting. Very large numbers are always compared digit by digit, so a one-digit change in a long ID is never missed.
What does the $ in a path mean?
It is the root of the document. A path like $.users[1].email means the email key of the second item in the users array. Keys that contain spaces or symbols are written in brackets with quotes.
Can I ignore fields such as timestamps?
Yes. Type the key names in the ignore box, separated by commas. Those keys are skipped wherever they appear in either document.
Can it compare very large files?
It works well for files of a few megabytes on each side. Browsers slow down when a text box holds a very large amount of text, so for files much bigger than that, compare a representative part.
Can it produce a JSON Patch?
Not at the moment. The output is a readable list of changes with their paths, which you can copy into a ticket or a review.