This JSON diff tool compares two JSON objects and highlights every added, removed, and changed value with color-coded results. The diff algorithm recursively traverses nested structures and reports differences using full dot-notation paths. All comparison logic runs entirely in your browser. Your JSON never leaves your device. Paste both objects above and see the diff instantly.
A JSON diff compares two JSON documents and produces a categorized report of every difference between them. The algorithm recursively traverses both documents in parallel, comparing values at each key path. At every node it can find one of four conditions:
For nested structures, the diff recurses into objects and reports differences at the leaf level using full dot-notation key paths (e.g., user.address.city). Array differences use bracket notation for indices (e.g., items[0].price). Type changes — where the same key holds a string in one document and a number in another — are reported as changed values with both the old and new types shown. A summary count at the top of the results shows how many additions, removals, and changes were found at a glance.
A developer updates a user profile API and needs to document exactly what changed between v1 and v2 of the response schema. They paste v1 into JSON A:
{
"id": 42,
"name": "Alice",
"role": "user",
"legacy_id": "USR-042"
}And v2 into JSON B:
{
"id": 42,
"name": "Alice",
"role": "admin",
"created_at": "2024-01-15"
}The diff shows three changes immediately: role changed from "user" to "admin", legacy_id was removed, and created_at was added. The two unchanged fields — id and name — can be toggled off to focus only on what changed. The diff output becomes a precise, reviewable changelog that can be included in API documentation, a pull request description, or a migration guide for API consumers.
Deep vs. shallow comparison:This tool performs a full recursive diff — it inspects every level of nesting, not just top-level keys. A shallow comparison would flag an entire nested object as “changed” even if only one leaf field differed; a deep diff reports exactly which leaf field changed and what the old and new values were. This precision is essential when working with complex API responses or configuration objects.
Array ordering: Arrays are compared by index position, not by value identity. If two arrays contain the same items in a different order, the diff reports each element at the same index as changed. This is semantically correct for ordered data like paginated results, but may be surprising for unordered sets like permission lists or tag arrays. If order should not matter for a comparison, sort the arrays in both documents before diffing.
Common use cases: Comparing API response schemas across versions to document breaking changes; reviewing configuration differences between environments (dev, staging, production); debugging state mutations in front-end applications; validating that a data migration preserved all fields correctly; auditing changes to feature flag definitions or permission structures in access control configs; spotting unintended changes in test fixtures after a code update.
Paste the first JSON into the "JSON A" panel and the second into "JSON B". The diff runs automatically and shows all differences below: added keys in green, removed keys in red, and changed values in amber. A summary counts each type of change.
The diff shows four categories: added (keys present in B but not A), removed (keys present in A but not B), changed (keys present in both but with different values), and unchanged (identical in both). You can toggle unchanged entries on or off. For changed values, both the old and new values are shown side by side.
Yes. The diff recursively traverses nested objects and arrays. Paths to nested keys use dot notation (e.g. user.address.city) and array indices use bracket notation (e.g. items[0].price). Every leaf-level difference is reported with its full path.
No. The entire diff algorithm runs in your browser using plain JavaScript. No data is transmitted. You can disconnect from the internet after the page loads and the diff tool will continue to work.
A JSON diff shows what changed between two objects — it is read-only and non-destructive. A merge combines two objects into one, resolving conflicts. formatjson.app's diff tool is purely for comparison: it highlights differences but does not produce a merged output.