JSON Diff

Compare two JSON objects and see differences.

Developer

Compare two JSON objects or arrays side by side and instantly see every difference — added keys, removed keys, and changed values. JSON comparison is essential when debugging API responses, reviewing configuration changes, validating data migrations, or tracking how a JSON structure evolves over time. This tool performs a deep, recursive comparison that handles nested objects and arrays, highlighting exactly what changed between the two versions. All processing runs entirely in your browser — your JSON data is never sent to any server, making it safe for comparing sensitive configurations, API keys, and proprietary data structures.

About JSON Diff

The JSON Diff tool performs a structural comparison of two JSON values — objects, arrays, strings, numbers, booleans, and null — and reports every difference found. For objects, it identifies keys present only in one side, keys with different values, and keys that are identical. Nested objects and arrays are compared recursively, so deeply nested differences are surfaced with their full path. This is invaluable for comparing API responses between environments (staging vs. production), reviewing configuration file changes before deployment, and validating that data transformations produce the expected output. The comparison is key-based for objects and index-based for arrays. All processing runs client-side in your browser. For validating JSON syntax, use our JSON Validator, and for formatting, try our JSON Formatter.

How to Use JSON Diff

  1. Paste the first JSON document in the JSON A field (e.g., the "before" or "expected" version).
  2. Paste the second JSON document in the JSON B field (e.g., the "after" or "actual" version).
  3. Click Compare JSON to run the recursive comparison.
  4. Review the highlighted differences: added keys, removed keys, and changed values are clearly marked for easy scanning.

Key Features

  • Deep recursive comparison — Compares nested objects and arrays at every level, surfacing differences with their full JSON path.
  • Clear difference categories — Distinguishes between keys only in A, keys only in B, and keys with different values.
  • Key-order independent — Object comparison is based on key names and values, not their order in the JSON.
  • Supports all JSON types — Compares objects, arrays, strings, numbers, booleans, and null values correctly.
  • Browser-based processing — All comparison runs locally in your browser. Your data never leaves your device.
  • Highlighted output — Differences are visually highlighted for quick identification.

When to Use This Tool

  • Comparing API responses between environments (development, staging, production) to identify discrepancies.
  • Reviewing configuration file changes before deploying updates to production.
  • Validating data migration output by comparing source and destination JSON structures.
  • Debugging unexpected behavior by comparing the expected JSON with the actual response.
  • Tracking how a JSON schema or data structure evolves across versions.

Technical Details

The comparison algorithm works by first parsing both inputs as JSON. For objects, it iterates over all keys in both sides, classifying each as "only in A," "only in B," or "in both." Keys present in both are compared by value — if both values are objects or arrays, the comparison recurses; otherwise, strict equality is used. Arrays are compared by index position. The tool reports differences with their full dot-notation path (e.g., config.database.host) so you can locate them precisely in the original documents. Both inputs must be valid JSON — use our JSON Validator to check syntax before comparing. For sorting JSON keys to normalize structure before comparison, see our JSON Key Sorter.

Conclusion

JSON Diff is a powerful debugging and validation tool that makes it easy to spot differences between any two JSON structures. With deep recursive comparison and clear visual highlighting, you can quickly identify changes — all processed privately in your browser with no server dependency.

Frequently Asked Questions

How are differences displayed?
Differences are categorized and highlighted: keys or values present only in JSON A, keys or values present only in JSON B, and keys where the values differ between the two documents. The full path to each difference is shown for precise location.
Is my JSON sent to a server?
No. Both JSON documents are parsed and compared entirely in your browser using JavaScript. Nothing is uploaded to any server.
Does key order matter?
No. JSON objects are compared by key names and their values, regardless of the order keys appear in the document. Two objects with the same keys and values in different orders will show no differences.
Can I compare JSON arrays?
Yes. Arrays are compared by index position — element 0 of JSON A is compared with element 0 of JSON B, and so on. If the arrays have different lengths, extra elements are reported as differences.