# JSON Diff

> Compare & Find Differences Between Two JSON Documents

Free JSON diff tool. Compare two JSON documents and see differences instantly. Highlights added, removed, and modified values. 100% private.

URL: https://tools.scoreroute.com/tools/json-diff/

Markdown: https://tools.scoreroute.com/tools/json-diff/.md

## Compare JSON


### What is JSON Diff?

JSON Diff is a developer tool that compares two JSON documents and highlights the exact differences between them. Unlike manual comparison which is error-prone and time-consuming, this tool instantly shows you what changed: values that were added, removed, or modified. This is essential for debugging API responses, comparing configuration files, reviewing data migrations, and tracking changes in JSON data structures.


### How It Works

Paste your original JSON in the left panel and the modified version in the right panel. When you click Compare, the tool parses both documents and computes the differences at every level of the object hierarchy. Results appear with color coding: green for added values, red for removed values, and yellow for modifications that show both the old and new values. Each difference is labeled with its JSON path so you can locate it in your data.


### Real-World Use Cases

- **API Debugging:** Compare API responses before and after a code change to spot exactly what broke
- **Config Files:** Track what changed in your package.json or config.json between deployments
- **Database Diffs:** Compare JSON exports from databases before and after a migration
- **Webhook Inspection:** See exactly what changed in a Stripe or PayPal webhook payload
- **Code Review:** Diff JSON config changes in pull requests with precision


### JSON Structure Basics

JSON (JavaScript Object Notation) is a hierarchical data format with four primitive types: strings ("hello"), numbers (42), booleans (true/false), and null. Complex types include objects { "key": "value" } and arrays [ "item1", "item2" ]. When comparing two JSON documents, differences can occur at any nesting level. A value might be added (exists only in the right document), removed (exists only in the left), or modified (same key exists in both but with different values). Arrays are compared by position, and the tool handles nested objects recursively to show every change.


### Frequently Asked Questions

**What types of differences can JSON Diff detect?**

JSON Diff detects three types of changes: **Added** (a key exists in the right document but not in the left, shown in green), **Removed** (a key exists in the left but not in the right, shown in red), and **Modified** (a key exists in both but with different values, shown in yellow with both old and new values). Nested objects are compared recursively so no change goes unnoticed.

**Does the tool handle arrays?**

Yes. Arrays are compared by index position. If an item is added at index 2, it shows as an addition. If an item is removed from the middle of an array, it shows as a removal. If an item at a given index has a different value, it shows as a modification. The tool uses Longest Common Subsequence (LCS) matching to intelligently detect moved items within arrays.

**Is my JSON data sent to a server?**

No. All processing happens entirely within your browser using JavaScript. Your JSON documents never leave your device. This makes the tool completely private and secure for handling sensitive configuration files, API credentials, or proprietary data structures.

**What happens if my JSON is invalid?**

If either JSON panel contains invalid JSON syntax, the tool will display an error message indicating which panel has the problem and the approximate location of the error. Fix the syntax error and try comparing again. The tool validates both inputs before attempting any comparison.

**What is the difference between JSON Diff and a text diff tool?**

Text diff tools compare raw text character-by-character, which is not useful for JSON because formatting (whitespace, key order) changes constantly without representing real data changes. JSON Diff parses both documents into actual data structures and compares values. Two JSON documents with identical data but different formatting will show zero differences, which is the correct behavior for developers.

## References

- [RFC 6902 — JavaScript Object Notation (JSON) Patch](https://datatracker.ietf.org/doc/html/rfc6902)
- [JSON.org](https://www.json.org/json-en.html)

