JSON Diff — Compare Two JSON Documents
This free online JSON diff tool compares two JSON documents and shows a structural, path-level diff: exactly which values were added, removed, or changed. Paste the original JSON on the left and the modified JSON on the right, and the comparison updates live as you type. Every difference is keyed by its JSON path — such as user.age or items[0].price — so you can jump straight to the field that changed.
Unlike a plain text diff, a JSON diff ignores cosmetic differences like indentation, whitespace, and object key order, and instead compares the underlying data trees. That makes it ideal for reviewing API responses, tracking configuration drift, checking database exports, and confirming that a refactor left a payload unchanged. Everything runs locally in your browser — your JSON is never uploaded to a server, so it is safe for private and proprietary data.
How to use JSON Diff
- Paste the original JSON into the left (Original) box.
- Paste the modified JSON into the right (Modified) box. You can press "Load sample" to see a worked example.
- The diff appears instantly below, grouped and sorted by JSON path, with a summary of how many values were added, removed, and changed.
- Read each row: added values are green, removed values are red with a strikethrough, and changed values show the old value struck through followed by the new value.
- Toggle "Ignore array order" to compare arrays as unordered sets, or turn off "Treat differing types as changed" to ignore string-versus-number type differences.
- Press "Copy report" to copy a plain-text summary of every change to your clipboard.
How the diff is computed
The tool parses both sides into JavaScript values and walks them together, depth first. Objects are compared by key: keys present only on the left are marked Removed, keys present only on the right are marked Added, and keys present on both are compared recursively. Arrays are compared by index by default — position 0 against position 0, position 1 against position 1 — and any trailing elements that exist on only one side are reported as added or removed. A leaf value that exists on both sides but differs is marked Changed, showing the old and new values side by side.
Unchanged values are omitted entirely, so the report only ever shows what actually differs. When an entire object or array is added or removed, it is reported as a single entry at its path rather than being exploded into one row per nested leaf, which keeps large diffs readable.
user.age 36 to 37
user.roles[1] "author" to "editor"
user.roles[2] + "owner"
user.email + "ada@example.com"
user.addr - {"city":"London"}
items[0].price 10 to 15Comparison options
- Ignore array order: by default arrays are compared position by position, so [1,2,3] versus [3,2,1] reports differences. Enable this option to compare arrays as unordered multisets instead, so only genuinely added or missing elements are flagged regardless of position — useful for lists of tags, permissions, or IDs where order is not meaningful.
- Treat differing types as changed: when enabled (the default), a value of 5 and a value of "5" are reported as a change because their types differ. Disable it for a looser comparison that treats values as equal when their string forms match, which helps when one document quotes numbers and the other does not.
JSON paths and object key order
Each difference is labelled with the path from the document root to the value, using dot notation for ordinary keys (user.name) and bracket notation for array indices (roles[2]) and keys that are not valid identifiers (settings["max-retries"]). This is the same style used by tools like JMESPath and JavaScript property access, so a path can usually be pasted straight into code or a query.
Because objects are compared by key, the order in which keys appear in the source text never affects the result: {"a":1,"b":2} and {"b":2,"a":1} are treated as identical. If you also want byte-for-byte or line-by-line comparison that respects ordering and formatting, use a text diff instead.
Related terminology
- Structural diff
- A comparison of two documents by their parsed data structure rather than their raw text, ignoring formatting, whitespace, and key order.
- JSON path
- A dotted-and-bracketed expression identifying a value's location in a JSON document, such as user.roles[0], read from the root down to the value.
- Leaf value
- A terminal value in the JSON tree — a string, number, boolean, or null — as opposed to a container (object or array) that holds other values.
- Multiset comparison
- Comparing two collections by which elements they contain and how many times, without regard to order; used by the ignore-array-order option.
- Configuration drift
- The gradual, often unintended divergence of two configurations that were once identical — a common thing to catch with a JSON diff.
Frequently asked questions
- How do I compare two JSON files online?
- Paste the first JSON document into the left box and the second into the right box. The tool parses both, compares them by structure, and lists every value that was added, removed, or changed, each labelled with its JSON path. The comparison runs entirely in your browser as you type.
- How is a JSON diff different from a text diff?
- A text diff compares two documents line by line and flags any difference in characters, including reindentation, reordered keys, and whitespace. A JSON diff parses both sides first and compares the underlying data, so it ignores cosmetic changes and reports only real differences in values and structure, keyed by path.
- How are arrays compared?
- By default arrays are compared by index: element 0 against element 0, element 1 against element 1, and so on, with any extra trailing elements reported as added or removed. If element order does not matter, enable "Ignore array order" to compare the arrays as unordered sets instead, so only truly added or missing elements are flagged.
- Does the tool ignore object key order?
- Yes. Objects are compared by key, so {"a":1,"b":2} and {"b":2,"a":1} are treated as identical. Only differences in keys or their values are reported, never a change in the order the keys were written.
- What does "Treat differing types as changed" do?
- When it is on (the default), a number like 5 and the string "5" are reported as a change because their types differ. When you turn it off, values are compared loosely by their string form, so 5 and "5" are considered equal — handy when one document quotes its numbers and the other does not.
- Is my JSON data sent to a server?
- No. The entire comparison runs locally in your browser using client-side JavaScript. Your JSON is never uploaded, stored, or transmitted, which makes the tool safe for sensitive API responses, configuration files, and proprietary data.