JSON Diff — Compare Two JSON Objects

Compare two JSON objects and show differences by path. Added, removed, and changed values highlighted.

JSON A
JSON B
Enter JSON A and JSON B to compare.

About JSON Diff — Compare Two JSON Objects

JSON Diff Tool compares two JSON objects side by side and highlights added, removed, and changed values. Quickly identify differences between API responses, configuration files, and data snapshots.

How to Use

  1. 1Paste the first JSON into the left input and the second JSON into the right input.
  2. 2Click "Compare" to generate a highlighted diff of the two JSON objects.
  3. 3Review the colored output — green for added, red for removed, yellow for changed values.

Features

  • Side-by-side JSON comparison with color-coded differences
  • Detects added, removed, and changed keys and values
  • Useful for comparing API responses and config file changes
  • No server needed — comparison runs in the browser
01

How JSON Diffing Works

Comparing JSON objects goes beyond simple text comparison. A proper JSON diff understands the structure of the data, compares by key names rather than positions, and recurses into nested objects and arrays.

Key-Based vs Text-Based Comparison

A text diff tool compares JSON line by line, flagging any change in whitespace, key ordering, or formatting as a difference even when the data is semantically identical. A JSON-aware diff tool normalizes the structure first — it parses both inputs and compares the resulting data trees. This means {"a":1,"b":2} and {"b":2,"a":1} are treated as equivalent, because JSON objects are unordered by specification. This tool performs structural comparison, so you can compare minified JSON against prettified JSON without false positives from formatting differences.

Deep Comparison and Nested Structures

Real-world JSON data is rarely flat. API responses typically include nested objects and arrays several levels deep. This tool performs a recursive deep comparison, traversing into nested objects and array elements to find differences at any depth. When a nested value changes, the diff output shows the full path to the changed key so you can immediately locate it in the original JSON. For arrays, the tool compares elements by index — if the order of array items changes, those are flagged as differences. This is important for APIs where array ordering represents a sort order or sequence.

02

Common Use Cases for JSON Diffing

JSON comparison is a routine task in API development, configuration management, and data pipeline work. Understanding typical use cases helps you apply the tool effectively.

API Response Comparison

When refactoring a backend or migrating to a new API version, you need to confirm the response structure has not changed unexpectedly. Capture the response before and after the change, then paste both into this tool to see exactly what fields were added, removed, or modified. This is far more reliable than manually scanning two large JSON responses. Common scenarios include verifying that a database migration did not silently drop fields, confirming that a third-party API response format has not changed between versions, and checking that response normalization middleware is working correctly.

Configuration File Change Review

JSON configuration files for applications, infrastructure-as-code tools, and cloud services accumulate changes over time. Before deploying configuration changes, paste the old and new versions into this tool to get a clear view of exactly what changed. This is especially valuable when working with generated configuration files where changes can be subtle — for example, a Terraform plan JSON, a package-lock.json dependency tree, or a tsconfig.json before and after running a generator. The color-coded output makes it easy to spot unintended changes that may have been introduced by a tool or merge conflict.

FAQ

Does the order of keys matter?
JSON objects are unordered by specification. This tool compares by key name, not key order.
Can I compare nested JSON?
Yes. The tool performs a deep comparison, including nested objects and arrays.
What happens if the JSON is invalid?
The tool validates both inputs before comparing. If either is invalid JSON, an error message is shown.
How does JSON diff handle arrays with changed order?
Most JSON diff algorithms treat arrays as ordered sequences. If two arrays have the same elements in different order, it is reported as a complete replacement (all items removed, all items added) rather than a reorder operation. This can produce noisy diffs for JSON where array order is semantically irrelevant. If order-independent comparison is needed, sort the arrays before diffing, or use a specialized tool that supports array-as-set semantics.
Can I use JSON diff for API response comparison?
Yes — paste two API responses to see exactly what changed between API versions or between expected and actual responses. This is useful for debugging API changes, verifying that a refactored endpoint returns identical data, and comparing test fixtures against live responses. The structural diff makes it easy to spot added, removed, or changed fields at any nesting level, which would be difficult to identify by reading raw JSON.

Found a bug or something not working as expected?

Report a bug →