How to compare two JSON files online with this checker
Open each JSON file in any text editor, copy its full contents, and paste one document into the JSON A box and the other into the JSON B box. That is the whole setup: there is no upload button, no account and nothing to install, because this json diff checker runs entirely in your browser tab. The comparison runs as you paste and re-runs as you edit, and the Compare JSON button simply forces a fresh check whenever you want one. If a document arrives minified onto one long line, press the Format button under its box to pretty-print it with two-space indentation first — formatting never changes the result, but it makes the pasted text far easier to eyeball and to fix when the checker reports a parse error. Then read the result panel: every difference is listed with its full path, a badge marking it as added, removed or changed, and the values involved. When you need a record of the comparison, Copy puts a plain-text report on your clipboard and Download .txt saves the same report as json-diff-report.txt, ready to attach to a pull request, a ticket or an email.
One habit makes every comparison cleaner: compare like with like. Compare a full API response with a full API response, not with a hand-trimmed excerpt, and compare the same environment against itself over time — staging today against staging yesterday — rather than staging against production, where half the values legitimately differ. The checker will faithfully report every one of those legitimate differences too, and a flood of expected changes is the fastest way to miss the one change that actually matters.
How the structural comparison works
The first step is parsing, and it is more important than it sounds. A text comparison sees characters; a structural comparison sees data. When the parser reads your document, indentation, line breaks and spacing disappear, key order stops mattering, and the spellings 1 and 1.0 become the single number they both name. What survives parsing is the actual content: objects, arrays, strings, numbers, booleans and null. Comparing after parsing is what lets this json compare tool ignore a complete reformat of a file and still catch a single flipped boolean buried four levels deep.
The walk itself is a straightforward recursion. Starting at the root, the checker looks at the pair of values in front of it. If both are objects, it lines up their keys — the union of the keys from both sides, in alphabetical order so the report is stable — and steps into each key in turn. If both are arrays, it steps through them by index. If both are primitive values, it simply asks whether they are equal. Whenever the two sides disagree about type — an object where the other side has an array, a string where the other side has a number — the value is reported once, as changed, at that path, rather than exploding into dozens of meaningless inner differences. That single decision keeps reports readable: a replaced subtree is one line in the report, not a page of noise.
How to read the result: paths, badges and counts
Each difference is one card in the result panel. At the top of the card sits its path, written in the familiar JavaScript style: the dollar sign $ is the root of the document, a dot and a name step into an object key, and a number in square brackets steps into an array index. So $.user.address.city is the city key inside the address object inside the user object, and $.items[2].price is the price of the third object in the items array, counting from zero the way programmers count array positions. Keys that contain spaces or punctuation are written in bracket form, such as $["content-type"], so every path stays unambiguous. Next to the path, a coloured badge states the kind: green for added, red for removed, amber for changed. Underneath, the card shows the values themselves — the new value for an addition, the old value for a removal, and old then new for a change. Long values are shortened for display at 300 characters so one enormous string cannot swamp the panel; the comparison itself always uses the full value.
The four pills at the top total the report: differences added, removed and changed, and the overall total. Read them as a health check before you read a single card. A total of zero means the two documents carry identical data, whatever their formatting looked like. A small total after a small edit is reassuring. A huge total after a supposedly small edit is the classic warning sign that something structural happened — a wrapper object added, an array rebuilt, an identifier scheme changed — and the paths will show you exactly where the shape diverged.
A worked example, checked difference by difference
Start with the smallest honest example. The first document is {"a":1,"b":2} and the second is {"a":1,"b":3,"c":4}. Running exactly these two documents through this checker reports exactly 2 differences:
| Path | Result | Old value | New value |
|---|---|---|---|
| $.b | Changed | 2 | 3 |
| $.c | Added | — | 4 |
The key a produces no card at all, because 1 equals 1. The key b exists on both sides with different numbers, so it is changed. The key c exists only in the second document, so it is added. Nothing is removed. That is the entire logic of the tool in miniature — everything else is the same three questions asked at greater depth.
Now a nested case, closer to real API data. The first document is {"user":{"name":"Asha","roles":["admin","editor"]},"active":true} and the second is {"user":{"name":"Asha","roles":["admin","viewer"]},"active":true,"version":2}. The checker again reports exactly 2 differences: $.user.roles[1] changed from "editor" to "viewer", and $.version added with the value 2. The unchanged name, the unchanged first role and the unchanged active flag stay silent. Notice what did not happen: the tool did not flag the whole user object, or the whole roles array, because one element deep inside changed. Differences are reported at the deepest path where the two sides actually diverge, which is what makes a long report scannable — each card is one precise fact.
The three difference types
Every card in the report is one of three kinds. The table below defines each kind exactly as this checker uses the words, with the rule that produces it and a typical real-world cause.
| Type | Meaning | How it arises | Typical cause |
|---|---|---|---|
| Added | The path exists only in the second document. | A key present in JSON B but not JSON A, or an array element beyond the end of the first array. | A new field shipped in an API update; a new item appended to a list. |
| Removed | The path exists only in the first document. | A key present in JSON A but not JSON B, or an array element beyond the end of the second array. | A deprecated field dropped; a list that shrank. |
| Changed | The path exists in both documents, but the values differ. | Two primitives that are not equal, or two values of different types at the same path. | An edited price, a renamed status, a string that became a number. |
Two consequences of these definitions are worth internalising. First, there is deliberately no fourth "moved" type: JSON objects are unordered, so a key cannot move within an object, and when an array element genuinely relocates, the index-by-index comparison reports the honest consequence — changes at the affected indices. Second, a changed type is a change even when the text looks the same. The string "42" and the number 42 print alike and behave completely differently in code, and a structural checker that let that pass silently would be failing at its one job. When a card surprises you, look at the types first: quote marks in the displayed value tell you a string is involved.
Objects, arrays and the rules that decide equality
Objects ignore key order. This is not a convenience feature; it is the JSON specification itself, which defines an object as an unordered collection of name/value pairs. Two objects with the same keys and the same values are the same object, whether the keys were typed in the same order or not. Real systems reorder keys constantly — one serializer sorts them, another preserves insertion order, a proxy rewrites the payload — and a compare tool that flagged reordering would cry wolf on nearly every real document. So this checker matches object keys by name, always.
Arrays respect order, by index. Arrays are the opposite: a JSON array is an ordered sequence, and position is part of its meaning. The checker therefore compares position 0 with position 0, position 1 with position 1, and so on, recursing into elements that are themselves objects or arrays. The trade-off is stated plainly rather than hidden: insert one element at the front of an array and every following element shifts index, so a single insertion can appear as a run of changed elements plus one addition at the end. Smarter alignment exists — matching elements by an id field, for example — but it requires guessing which field identifies an element, and a wrong guess silently hides real differences. Index comparison never hides anything; it occasionally over-reports, and over-reporting is the safe direction for a checking tool.
Primitives compare by value and type. Strings must match character for character, including case. Booleans and null must match exactly. Numbers compare as numbers after parsing, so different spellings of one value — 1 and 1.0, 100 and 1e2 — are equal, because JSON has a single number type and the parser has already resolved the spelling. One honest caveat rides along with that: numbers are compared as JavaScript numbers, so integers beyond the safe-integer range (above 2^53) may lose precision before the comparison ever sees them — a limitation of the platform every browser-based JSON tool shares, and worth knowing if you compare documents full of very large identifiers stored as numbers. Storing such identifiers as strings, as most APIs do, avoids the issue entirely.
Invalid JSON: reading the error and its position
Half the value of a compare tool in daily work is that it parses strictly, because the most common reason two documents "will not compare" is that one of them is not actually JSON. Trailing commas, single quotes, unquoted keys, comments pasted in from a configuration file, a response body that was truncated mid-stream — all of these are everyday sights, and all of them are invalid JSON, however reasonable they look. When either side fails to parse, this checker shows the parser's own error message under that side's box and in the result panel, and it refuses to run the comparison until both sides parse. Nothing crashes and nothing is silently compared as text instead; a structural verdict on broken input would be a lie.
Modern browsers report a character position in their parse errors, and when that position is present the checker converts it into a line and column you can jump straight to. Read the error at that spot first: the actual mistake is usually at, or one token before, the reported position — a missing comma at the end of the previous line is the single most common culprit, followed by a missing closing bracket that only becomes apparent when the parser runs out of document. The Format button helps here too, not by fixing anything (it cannot run on invalid input) but because formatting the other, valid side shows you the shape the broken side should have. And if you are comparing a response you captured from a network tab, check the very end of the text: a body cut off mid-string is invalid no matter how clean its start looks.
What people use a JSON compare for
- API regression checks. Saving a known-good response and comparing it after a deploy, to find difference between two JSON objects that were supposed to be identical — and catching the renamed field, the null that replaced a number, or the array that quietly started arriving empty.
- Configuration drift. Comparing a working environment's configuration against a broken one, or last week's settings export against today's, to isolate the one value that changed among hundreds that did not.
- Webhook and payload debugging. Diffing the payload a provider sent against the payload your documentation promised, path by path, instead of eyeballing two walls of braces.
- Test fixtures and snapshots. Checking generated output against a stored fixture during development, with a readable list of differences rather than a pass/fail shrug.
- Data exports and migrations. Verifying that a record survived a move between systems with its fields intact — same keys, same values, same nesting — before the old system is switched off.
- Reviewing generated JSON. Comparing the output of two versions of a script, a template or an AI prompt, to see precisely what the new version changed before it ships.
In every case the pattern is the same: the documents are too large to compare by eye and too structured for a text diff to say anything useful. A path-by-path report turns an afternoon of squinting into a two-minute read.
This checker vs a text diff and vs doing it in code
The Text Diff Checker answers a neighbouring question: what changed between two texts, line by line? For JSON that has been reformatted, reordered or re-indented, a line diff drowns the answer in noise — nearly every line "changed" even when the data is identical. This tool exists for the data question. The two are complements, not rivals: use the text checker when the file itself is the artefact, as with hand-maintained configuration you read directly, and use this json compare tool when the data is the artefact, as with API payloads nobody reads raw. If you need to pretty-print, validate or minify a single document rather than compare two, the JSON Formatter is the right page.
Doing it in code is the other alternative, and for anything repeated it is the right one: a test suite should assert on structure automatically, and libraries in every language will produce diffs programmatically. What code cannot give you is the thirty-second answer to a one-off question about two documents already sitting in front of you, with no project, no install and no script to write and then distrust. That is the niche this page fills — and, honestly, its ceiling: it compares two documents, in this tab, once. Anything you find yourself comparing every day belongs in your test suite, and the downloaded report from this page makes a fine starting fixture for it.
Privacy first — and the honest limits
The comparison runs entirely in your browser tab. Nothing you paste is uploaded, transmitted or stored, and your JSON is never rendered as page HTML — results are built as plain text nodes, so markup inside a string value cannot execute. That matters because the documents people most need to compare are often the ones they least want to upload: production payloads, internal configuration, a customer's exported record. Two sensible cautions remain. A downloaded report is a file like any other, so store it where the document itself would live. And if a document contains live tokens or secrets as values, consider redacting them before comparing — the checker never sees a server, but your own screen, clipboard and downloads folder are still yours to manage. Closing the tab erases everything, so download the report first if you need a record.
The limits, plainly. The comparison is structural only: it reports where the data differs, never why, and it cannot judge whether a change is correct — only that it happened. Arrays compare by index, so insertions near the front of a long array produce a run of changed cards, as the equality section explains. Semantic equality is post-parse equality: numbers that spell differently but parse to the same value are equal, key order is meaningless, and formatting is invisible — usually exactly what you want, and worth knowing when it is not. Very large files may be slow: there is no artificial size cap, but the walk visits every value on both sides, and a multi-megabyte, deeply nested document can take a noticeable moment and a lot of memory in the tab; split such documents and compare them in parts. Finally, the tool compares two documents at a time — chain comparisons to follow a value across three or more versions.
Sources & References
- JSON.org — Introducing JSON — the JSON grammar from its originator's site, including the definition of an object as an unordered collection of name/value pairs.
- RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format — the IETF standard for JSON, defining its six value types and the single number type.
- MDN — JSON — the reference for the browser's built-in JSON object that parses both documents on this page.
- MDN — JSON.parse() — how parsing turns JSON text into values, and the errors it throws on invalid input.
- ECMA-404 — The JSON Data Interchange Syntax — the Ecma International standard defining JSON syntax independently of any programming language.
- MDN — JSON.stringify() — how values are turned back into JSON text, used here by the Format buttons and the value display.
- MDN — Working with JSON — a practical guide to JSON structure, nesting and arrays, for readers new to the format.