JSON Diff

Compare two JSON documents side by side and highlight added, removed, and changed values. Structural comparison β€” runs entirely in your browser, no data is sent to any server.

Frequently Asked Questions

It performs a structural (semantic) diff, not a plain text diff. Both inputs are parsed into JSON, then compared key by key and element by element. This means object key order does not matter β€” {"a":1,"b":2} and {"b":2,"a":1} are treated as identical.

Red = removed (present only in the original). Green = added (present only in the modified). Amber = the value changed between the two. Unhighlighted lines are unchanged.

No. Both JSON documents are parsed and compared entirely in your browser with JavaScript. Nothing is uploaded, logged, or stored.

Arrays are compared by index (position). The first element of one array is compared with the first of the other, and so on. If one array is longer, the extra elements are shown as added or removed. Reordering array items will therefore be reported as changes.

If a key holds a string in one document and an object in the other (for example), the tool treats the old value as removed and the new value as added, so you can see the full before-and-after at that path.

Both inputs must be valid JSON. Common causes are trailing commas, single quotes instead of double quotes, unquoted keys, or comments (JSON has no comment syntax). The error message names which side failed and the parser's reason. Use the JSON Formatter tool to locate the exact problem.

Yes, within reason. Because everything runs in the browser, very large documents (multiple megabytes) may be slow to render. For huge files, compare a relevant subtree rather than the whole document.

Yes. Since the comparison happens on the parsed data structure, indentation, line breaks, and key ordering are irrelevant. Only actual differences in keys and values are reported.

JSON Patch (RFC 6902) is a standardised format for expressing a sequence of operations (add, remove, replace, move, copy, test) that transforms one JSON document into another. A JSON diff is the process of computing those differences; JSON Patch is a machine-readable way to serialise and apply them. Libraries like fast-json-patch (JS) and jsonpatch (Python) can generate and apply RFC 6902 patches programmatically.

A text diff (like git diff or Unix diff) compares raw characters line by line. It will flag a change if you simply reformat or reorder keys, even when the data is logically identical. A structural diff parses both sides first, then compares the in-memory data trees β€” so reformatting, reindenting, or reordering object keys produces zero differences. For JSON, structural diffing is almost always more useful because it reflects actual data changes rather than cosmetic edits.

About This JSON Diff Tool

This free JSON diff tool compares two JSON documents and highlights exactly what changed between them. Unlike a plain text diff, it parses both sides into their underlying data structures first, so differences in formatting, indentation, and key order are ignored β€” only real changes to keys and values are reported.

Comparing JSON is a routine task when reviewing API responses across versions, validating configuration changes, debugging data syncs, or auditing what an edit actually modified. A side-by-side structural diff makes those changes obvious at a glance.

When to use this tool

  • Spotting what changed between two API responses
  • Reviewing config file edits before deploying
  • Auditing the result of a data migration or transform
  • Comparing expected vs. actual output in tests

How JSON Diffing Works

Three steps run every time you click Compare:

Parse

Each side is parsed with JSON.parse(). If either fails, a clear error tells you which input is invalid and why.

Walk

Both structures are walked recursively. Objects are matched by key (order-independent); arrays are matched by index. Each node is classified as unchanged, added, removed, or changed.

Render

The result is laid out as aligned side-by-side rows with red, green, and amber highlights, plus a summary count of each change type.

Common Use Cases

API Version Comparison

Compare the same endpoint's response across two API versions to see which fields were added, removed, or renamed before upgrading a client.

Config Change Review

Diff before and after versions of a JSON config to confirm an edit changed only what you intended.

Test Assertions

Compare expected vs. actual JSON when a test fails, to pinpoint the exact field causing the mismatch.

Data Migration Audits

Verify that a transform or migration preserved the right data by diffing a sample record before and after.