About JSON Diff
A JSON diff compares two JSON documents structurally — by their parsed data, not their text. That distinction is the whole point: two documents can be textually different (different key order, different indentation, different escaping) while being semantically identical. A text diff like git diff will drown you in whitespace noise; a structural diff tells you what actually changed: which keys were added, which were removed, and which values differ.
Typical uses: comparing API responses between staging and production, checking what a deploy changed in a config file, verifying that a data migration preserved every field, and debugging why two supposedly identical payloads behave differently. The comparison runs entirely in your browser — both documents stay on your machine.
How to use JSON Diff
- Use the input area to enter or paste your data.
- Use the main action button to run the tool.
- Copy or download the output as needed.
Example
Input
Your input or data here
Output
Result will appear here after running the tool
How structural comparison works
Both inputs are parsed into trees, then the trees are walked in parallel. At each path, the differ classifies the outcome: identical (values match), changed (both sides have the key but values differ), added (only in the right document), or removed (only in the left document). Nested objects are compared recursively, so a change deep inside an object is reported at its exact path rather than flagging the whole object as different.
Because comparison happens after parsing, formatting differences vanish: {"a":1,"b":2} and a pretty-printed version with keys in the opposite order compare as identical objects. This is exactly what you want when comparing an API response you formatted against a raw one from a log.
The array ordering problem
Objects are unordered in JSON, but arrays are ordered by definition — [1,2] and [2,1] are genuinely different values. A structural differ therefore compares arrays element by element by index. This has a practical consequence: if your API returns list items in nondeterministic order (a common result of SQL queries without ORDER BY), the diff will report many changes that are really just reordering.
When that happens, the fix is to normalize before diffing: sort both arrays by a stable key (like id) on the producing side, or use the JSON Sort Keys tool for objects. If two diffs of the same endpoint keep showing spurious array changes, treat it as a signal that the API's ordering is unstable — that is worth fixing at the source, since it also breaks HTTP caching and pagination.
Reading a diff efficiently
Start with removed keys — they break consumers most often, because code that reads a missing property gets undefined and fails somewhere far from the actual cause. Then review changed values, paying attention to type changes (the string "42" versus the number 42 is one of the most common breaking changes between API versions, and one many eyes skip over). Added keys are usually safe for consumers but confirm they are intentional; accidentally leaking new fields is a classic way internal data escapes into public APIs.
Common errors and how to fix them
One side fails to parse
Cause: The diff needs two valid JSON documents; a syntax error on either side stops the comparison.
Fix: Validate each side first — the error message points at the failing line and column of that side.
Everything shows as changed
Cause: The two documents have different root types (object vs array), or one side is double-encoded — a JSON string containing JSON.
Fix: Check whether one input starts with a quote character. If a payload looks like "{\"a\":1}", unescape it first (JSON Unescape tool), then diff.
Huge diff full of array changes
Cause: Array elements are compared by position, and the two documents list the same items in different orders.
Fix: Sort both arrays by a stable field before comparing, or export the data with a deterministic ORDER BY.
Numbers that look equal report as different
Cause: Values like 1 and 1.0, or 0.1+0.2 style floating point artifacts (0.30000000000000004), differ at the parsed-value level.
Fix: Round floating point values to a fixed precision on the producing side before comparing.
Tips and best practices
- Diff formatted documents when you plan to read the result — the diff itself is structural, but your eyes still benefit from formatted context.
- For recurring comparisons (e.g., contract testing between environments), automate with a CLI equivalent: jd, jsondiff (Python), or deep-equal assertions in your test framework. Use this page for the interactive cases.
- A type change (string ↔ number, null ↔ absent) is more dangerous than a value change — scan the diff for those first.
- Comparing before/after of a migration? Removed keys on the 'after' side are your data-loss checklist.
Frequently asked questions
- Does key order affect the comparison?
- No. JSON objects are unordered, and the diff compares parsed values. {"a":1,"b":2} equals {"b":2,"a":1}. Array order, by contrast, does matter — arrays are ordered by definition.
- Is this a text diff or a structural diff?
- Structural. Both documents are parsed first, so whitespace, indentation, key order, and string escaping differences are invisible. Only real data differences are reported.
- Can I diff two API responses that contain timestamps?
- Yes, but volatile fields like timestamps, request IDs, and cache keys will always differ. Mentally exclude them, or strip them before comparing if they drown out the signal.
- How large can the documents be?
- Up to 10 MB per side; large comparisons run in a Web Worker so the UI stays responsive.
- Why does 1 vs "1" show as a change?
- Because it is one — the number 1 and the string "1" are different JSON values, and this exact difference breaks strictly-typed consumers. The diff is doing you a favor by surfacing it.
- Is my data uploaded?
- No. Parsing and comparison run entirely in your browser.
Embed this tool
Add JSON Diff to your own site, blog post, or internal docs — free, no signup. The widget runs entirely in your visitors' browsers, same as it does here.
Related tools
- JSON FormatterFormat and beautify JSON with indentation
- JSON ValidatorValidate JSON syntax and show error location
- JSON MinifierRemove whitespace and compress JSON
- JSON ViewerInteractive tree and graph visualization of JSON structure
- JSON to CSVConvert JSON array or object to CSV
- JSON to YAMLConvert JSON to YAML format