JSON Diff — Compare Two JSON Objects
Compare two JSON objects side by side. Auto-formats, sorts keys, and highlights differences line by line.
How to Use
- Paste your first JSON into the left panel
- Paste your second JSON into the right panel
- Click Compare — both sides are auto-formatted and sorted
- Differences are highlighted: red for removed lines, green for added lines
Frequently Asked Questions
-
Does key order matter?
No. Both JSON objects are sorted by keys before comparing, so differences in key order are ignored.
-
Can I compare nested objects?
Yes. The diff works on the formatted text after sorting, so nested structures are fully compared.
-
What do the colors mean?
Red lines exist only in the left (original) input. Green lines exist only in the right (modified) input. Unchanged lines have no highlight.
-
Is my data sent to a server?
No. All processing happens entirely in your browser.
Why Compare JSON?
JSON diff is an essential tool whenever you need to understand what changed between two versions of a data structure. The use cases span the full software development lifecycle:
API versioning: When an API provider releases a new version, comparing the old and new response schemas immediately reveals what fields were added, removed, or renamed — without reading through documentation.
Configuration management: Infrastructure-as-code tools like Terraform output JSON plans. Comparing the current state against the desired state (or two plan files) shows exactly what changes will be applied before running.
Database migration auditing: Comparing JSON snapshots of database records before and after a migration verifies that the migration did what was intended and nothing else.
Debugging webhooks: When a webhook payload stops working, comparing a working payload against a broken one immediately isolates the structural difference.
A/B testing: Comparing configuration objects for different experiment variants helps catch unintended differences between groups.
Why Standard Text Diff Falls Short for JSON
A generic text diff tool like git diff compares files line by line. This works poorly for JSON because:
- Key order is semantically irrelevant in JSON objects, but text diff treats
{"a":1,"b":2}and{"b":2,"a":1}as completely different. - Indentation differences produce massive diffs that obscure actual data changes.
- Minified vs. formatted JSON produces a diff showing every line as changed.
A proper JSON diff tool normalizes both inputs — sorting keys and standardizing formatting — before comparing. This produces a diff that reflects semantic differences, not presentation differences.
Reading the Diff Output
This tool uses a standard unified diff format with color coding:
- Red lines (−): Present in the left input only. These are removed or changed values.
- Green lines (+): Present in the right input only. These are added or changed values.
- Unchanged lines: Present in both inputs with the same value.
A changed value typically appears as a red line immediately followed by a green line — the old value removed, the new value added.
Tips for Clean Comparisons
- If you're comparing API responses captured at different times, strip timestamp fields first to avoid noisy diffs.
- For very large JSON objects, focus on the summary count of added/removed lines as a sanity check before diving into details.
- Use the key-sorted output to verify that no fields were accidentally dropped during a data transformation or migration.