JSON Diff
How to use this JSON diff tool
- Paste your original JSON into "JSON A".
- Paste the updated version into "JSON B".
- Differences appear below: green for added, red for removed, orange for changed.
How does this comparison work?
The tool walks both JSON objects key by key, recursively comparing nested objects, and reports any key that's missing, added, or has a different value — useful for comparing API responses or config files across versions.
Does array order matter in the comparison?
Arrays are compared as whole values, so a reordered array with the same elements will show up as "changed" — this tool doesn't do element-by-element array diffing.
What if my JSON is invalid?
The tool shows an error message asking you to check both inputs — use the JSON Formatter tool first if you need help finding the exact syntax error.
Why comparing JSON structurally beats comparing it as plain text
A generic text diff tool compares two JSON files line by line, character by character — which means purely cosmetic differences like reordered object keys, different indentation, or trailing whitespace show up as changes even when the underlying data is functionally identical. A structural JSON diff instead parses both inputs into their actual data structure first, then recursively compares keys and values within that structure, which means {"a":1,"b":2} and {"b":2,"a":1} are correctly recognized as equivalent, since JSON objects are conceptually unordered key-value collections regardless of the order their keys happen to be written in. This structural approach is precisely what makes a JSON-aware diff meaningfully more useful than a generic text diff specifically for comparing API responses or config files, where formatting differences are common and genuinely irrelevant, but actual data changes are what you're trying to find.
Why array comparison is a fundamentally harder problem than object comparison
Comparing two objects is relatively straightforward because each value has a named key to match it against directly. Arrays have no such built-in anchor — if one array has an element inserted at the beginning, every single subsequent element's index shifts by one, and a naive position-by-position comparison would then report every element as "changed" even though only one was genuinely added. Correctly detecting an actual insertion or removal within an array — rather than a wholesale change — requires an algorithm similar to the longest common subsequence problem used in text-based diff tools like git diff, which is considerably more computationally involved than simple key matching. This is exactly why comparing arrays as whole values (flagging the entire array as changed if anything about it differs) rather than attempting true element-by-element array diffing is a common, deliberate simplification even in fairly sophisticated diff tools.
Common real-world uses: API regression testing and config drift detection
JSON diffing has two particularly common, practical applications worth calling out specifically. The first is API regression testing — capturing a known-good API response, then comparing it against the response from a new deployment or code change to confirm nothing unexpected shifted in the response shape or values, which is a fast, effective way to catch an accidental breaking change before it reaches production. The second is configuration drift detection — comparing a server's or application's actual current configuration against its intended, version-controlled configuration to catch manual changes that were made directly in production and never got reflected back into source control, a common and often-overlooked source of hard-to-reproduce bugs and "it works on my machine" style incidents.
Semantic differences versus formatting differences — why this distinction matters
Beyond key ordering, there are several other differences between two pieces of JSON that are purely about formatting rather than actual data meaning, and a good JSON diff tool should generally treat these as equivalent rather than flagging them as changes. Whitespace and indentation style, whether numbers are written as 1.0 versus 1 (both parse to the identical numeric value in JSON), and the specific order keys happen to be written in are all formatting-level differences that don't represent any actual change to the underlying data. A JSON-aware diff parses past all of this cosmetic noise and compares the genuine parsed values directly, which is precisely the core advantage over line-by-line text diffing described above.
Limitations of this tool
This tool performs a structural, key-by-key JSON comparison — as explained above, it compares arrays as whole values rather than doing true element-by-element array diffing, so a reordered array with identical elements will show up as "changed" even though its actual contents are the same. It requires both inputs to be valid, parseable JSON to compare at all — if either input has a syntax error, use the JSON Formatter tool first to locate and fix it. It also doesn't generate a machine-readable diff format like JSON Patch (RFC 6902) for programmatic use — the output here is designed for human visual review, not automated processing.