Analyse
JSON Diff
The JSON diff tool compares two JSON documents and highlights the differences between them at the structural level. It detects added keys, removed keys, and changed values, and presents the result in a color-coded side-by-side or unified view. Unlike plain text diff, it understands JSON structure so it can detect moved keys and changes in nested objects accurately.
What is the JSON Diff Tool?
The JSON diff tool performs a semantic comparison of two JSON documents. Rather than comparing them as raw text (which would flag trivial differences like different key ordering or whitespace), it parses both documents into data structures and compares them key by key and value by value. Added properties are shown in green, removed properties in red, and changed values display both the old and new value. This makes it easy to spot meaningful differences in API responses, configuration files, or data snapshots.
How does it work?
Both JSON inputs are parsed and validated. The tool then performs a deep recursive comparison of the two object trees. For each key in either document, it determines whether the key is present in both (and compares values), present only in the left (removed), or present only in the right (added). For arrays, elements are compared by position. The result is rendered as a color-coded diff view where you can collapse unchanged sections to focus on the differences.
Typical Use Cases
- Comparing API responses before and after a code change to verify behavior
- Reviewing changes between two versions of a JSON configuration file
- Validating that a data transformation produced the expected output
- Debugging differences between a staging and production API response
Step-by-step Guide
- Step 1: Paste the first (original) JSON document into the left panel.
- Step 2: Paste the second (modified) JSON document into the right panel.
- Step 3: Click Compare to run the diff.
- Step 4: Review the highlighted additions, deletions, and changes.
Example
Input
Left: {"status":"active","count":5} | Right: {"status":"inactive","count":5,"reason":"timeout"}
Output
Changed: status (active → inactive) | Added: reason: 'timeout'
Tips & Notes
- Format both JSON documents before diffing to avoid false differences from whitespace.
- For large JSON files, collapse unchanged sections to focus on the relevant differences.
- If key order differs between the two documents, the semantic diff will not flag this as a difference — JSON objects are unordered by definition.
Frequently Asked Questions
Does key order matter in the diff?
No. JSON objects are unordered, so the diff compares by key name, not by position. Two objects with the same keys and values in different orders are considered identical.
How are array differences handled?
Array elements are compared by index position. If an element is inserted at the beginning of an array, all subsequent elements appear as changed because their index has shifted. For semantic array diffing, the elements would need to be matched by a unique identifier.
JSON Diff
Compare two JSON objects and see the differences at a glance — with color-coded highlighting and a path overview.
Open Tool