JSON Diff Viewer
Compare two JSON objects and highlight added, removed, and changed values.
Safe conversion with no data sent to server
Last updated: March 2026
What is JSON Diff Comparison?
JSON diff comparison is the process of analyzing two JSON documents to identify the differences between them. Just as text diff tools compare lines of code, a JSON diff tool understands the structure of JSON data -- objects, arrays, nested properties, and values -- to produce a meaningful, structured comparison. It categorizes changes into three types: added fields (present in the right document but not the left), removed fields (present in the left but not the right), and changed values (same key exists in both but with different values).
Structural comparison is far more useful than raw text diffing for JSON data. A simple text diff would flag reordered object keys as changes, even though JSON objects are unordered by specification. This tool performs a deep, key-aware comparison that correctly identifies {"a":1,"b":2} and {"b":2,"a":1} as identical. It also traverses nested objects and arrays recursively, reporting differences at the exact path where they occur (e.g., "user.address.city").
The diff viewer uses color coding for quick scanning: green for additions, red for removals, and yellow for changed values. The "Hide unchanged fields" option lets you focus only on what is different, which is especially useful when comparing large JSON documents where only a few fields have changed.
How to Use This JSON Diff Tool
Compare two JSON documents side by side:
- Paste your first JSON document into the "JSON A (Left)" field. This serves as the base or "before" version.
- Paste your second JSON document into the "JSON B (Right)" field. This is the "after" version you are comparing against.
- Click "Compare" to analyze the differences.
- Review the color-coded results: green (+) for added fields, red (-) for removed fields, and yellow (~) for changed values with both old and new values shown.
- Toggle "Hide unchanged fields" to focus only on the differences, filtering out matching fields.
Interpreting results: Each diff entry shows the JSON path (e.g., "user.email") and the relevant values. For changed fields, you will see the old value struck through alongside the new value, making it easy to understand exactly what changed at each path.
Common Use Cases
- API response debugging: Compare API responses before and after code changes to verify that only expected fields changed and no regressions occurred.
- Configuration auditing: Diff JSON configuration files (package.json, tsconfig.json, app settings) to review what changed between deployments or versions.
- Database record comparison: Compare JSON representations of database records to identify field-level changes during data migration or synchronization.
- Code review assistance: Verify that JSON fixtures, mock data, or seed files in pull requests contain only the intended changes.
- Schema evolution tracking: Compare API response schemas over time to detect breaking changes, new fields, or removed properties.
- Testing and QA: Compare expected vs. actual JSON outputs in test results to pinpoint exactly which values or fields differ.
FAQ
Does key order matter in the comparison?
No. JSON objects are unordered collections of key-value pairs per the specification. This tool compares by key names, not by position, so {"a":1,"b":2} and {"b":2,"a":1} are treated as identical. This is more accurate than text-based diff tools that would flag reordered keys as changes.
How are nested objects compared?
The tool performs a deep recursive comparison. It traverses all levels of nesting and reports differences at the exact path where they occur. For example, if only the city in a deeply nested address object changed, the diff will show the path as "user.address.city" rather than flagging the entire parent object as changed.
How are arrays compared?
Arrays are compared by index position. The tool checks each index in both arrays and reports added elements (index exists only in B), removed elements (index exists only in A), and changed elements (same index, different values). For objects within arrays, the comparison is performed recursively on each matching index.
What does the path notation mean in the diff output?
The path shows the exact location of each difference using dot notation for object properties and bracket notation for array indices. For example, "users[0].name" means the "name" property of the first element in the "users" array. "(root)" indicates a difference at the top level of the JSON document.