deftools.io Developer Tools

JSON Diff

Compare two JSON objects semantically. Shows added, removed, changed, and type-changed keys with full dot-path notation. Handles nested objects and arrays.

Enter JSON in both fields and click Compare.
Copied!

About this tool

JSON Diff compares two JSON values and reports exactly what changed — added, removed, modified, and type-changed fields — using full dot-and-bracket paths like owner.email or tags[2]. It works on nested objects and arrays, ignores key order by default, and can emit an RFC 6902 JSON Patch you can apply programmatically.

Example: comparing { "version": 1 } against { "version": 2 } highlights path version as changed from 1 to 2. Comparing two API responses side by side shows which fields a deploy added or renamed.

Handy for reviewing config diffs, spotting drift between two environment files, diffing an API response before and after a migration, or generating a JSON Patch to send to a PATCH endpoint. Use J/K or / to step through changes and Ctrl+Enter to re-run the comparison.

FAQ

Does it compare arrays by index or by value?

By index. Element [0] is compared with [0], [1] with [1], and so on. If you insert an item at the start of an array, every following element will show as changed because the positions shifted — reorder or append at the end for cleaner diffs.

What is the JSON Patch view?

It outputs an RFC 6902 patch array of add, remove, and replace operations with JSON Pointer paths (e.g. "/owner/email"). You can copy it and apply it with any JSON Patch library to transform the original document into the modified one.

Why does the diff ignore key order by default?

In JSON, object key order is not significant — two objects with the same keys in different orders are equal. You can uncheck "Ignore key order" if you specifically want to detect reordering.

How are type changes shown?

When a value changes type (for example a number becomes a string), the diff marks it as a type change and displays both the old and new values with their types, so you can catch accidental stringification in API responses.

I need to compare plain text or code, not JSON — what should I use?

For general-purpose line-by-line text comparison with word-level highlighting, use the <a href="/diff-checker" class="text-accent hover:underline">Diff Checker</a>. It handles code, prose, config files, and supports keyboard navigation between changes.

How do I generate an RFC 6902 patch from my diff?

This tool includes a JSON Patch output mode that produces RFC 6902 operations you can copy. For a dedicated tool that compares two JSON objects and outputs only the patch document (with optional test guards for safe partial updates), use the <a href="/json-patch" class="text-accent hover:underline">JSON Patch Generator</a>.

More developer tools

Copied!