Compare two JSON documents
A structural diff that ignores key order and whitespace. Paste two JSON documents to see exactly what was added, removed, and changed — with paths you can click to copy. Export the result as an RFC 6902 JSON Patch.
Structural diff, not text diff
Most diff tools are character-level — they compare strings. That makes them blind to JSON's actual semantics: object key order doesn't matter, and indentation choices shouldn't show up as changes.
JSON FYI's diff parses both sides into structured values, then walks the trees in parallel. Each leaf is compared by value, each container by membership. The output is a tree where every difference is annotated with a path you can click to copy. You can also flip to a JSON Patch view to get a standard RFC 6902 patch — apply it in code with fast-json-patch, jsonpatch, or any library that speaks the spec.
Arrays are compared positionally: index 0 against index 0, and so on. This matches how most APIs and config files use arrays. For unordered sets, sort both sides before comparing.
Examples
{
"limits": { "maxDepth": 32, "maxFileMb": 10 },
"tools": ["validator", "formatter"]
}{
"limits": { "maxDepth": 64, "maxFileMb": 10 },
"tools": ["validator", "formatter", "diff"]
}Spot the value change at limits.maxDepth and the new tool added at tools[2].
{ "id": 1, "name": "Ada", "active": true }{ "id": 1, "name": "Ada", "active": true, "createdAt": "2025-01-01" }An additive change — new field, no breakage. The diff highlights the addition explicitly.
{"a":1,"b":2,"c":3}{
"c": 3,
"b": 2,
"a": 1
}Different whitespace, different key order — but the same JSON. The diff shows zero changes.
Use cases
- Code review of fixture changes
When a teammate updates a JSON fixture, paste before/after to read the actual semantic delta.
- API regression testing
Compare today's response against yesterday's snapshot to spot unintended schema changes.
- Config drift between environments
Diff prod vs. staging configs to find values someone forgot to sync.
- Schema migration validation
Verify that your migration script produced exactly the changes you expected — nothing more.
- Generating JSON Patch payloads
Build PATCH request bodies from a before/after pair without writing diff logic by hand.
Frequently asked questions
How is this different from a text diff?+
A text diff compares characters and is sensitive to whitespace and key order. A JSON diff parses both sides into structured values and compares them by path. Reordered object keys, different indentation, and trailing commas don't show up as changes.
How are arrays compared?+
Positionally — index 0 against index 0, index 1 against index 1, and so on. If you reorder a list, expect every position to show as changed. For order-independent comparison, sort the arrays before pasting.
What's an RFC 6902 JSON Patch?+
A standard format for describing changes to a JSON document as a list of operations: add, remove, replace, copy, move, test. Switch to the JSON Patch tab to copy a patch you can apply with libraries like fast-json-patch (JS), jsonpatch (Python), or evanphx/json-patch (Go).
Are duplicate keys treated specially?+
JSON parsers keep only the last value when keys are duplicated, so the diff sees the last value too. The validator on the home page warns about duplicates if you want to clean them up first.
Can I diff two big files?+
Yes — both inputs accept up to 10 MB via drag-and-drop or the Upload button. Everything runs in your browser; nothing is uploaded.
What does the path on each diff mean?+
It's a JSONPath expression pointing to the changed value, like $.users[2].email. Click the chip beside any diff row to copy it.
Compare JSON in code
JavaScript, Python, Go, and Ruby snippets — copy and paste into your project.
Read two JSON files and emit the standard JSON Patch operations needed to transform one into the other.
import { readFileSync, writeFileSync } from "node:fs";
import jsonpatch from "fast-json-patch";
const left = JSON.parse(readFileSync("left.json", "utf8"));
const right = JSON.parse(readFileSync("right.json", "utf8"));
const patch = jsonpatch.compare(left, right);
writeFileSync("patch.json", JSON.stringify(patch, null, 2));{ "version": "1.3.0", "tools": ["a", "b"] }
{ "version": "1.4.0", "tools": ["a", "b", "c"] }[
{ "op": "replace", "path": "/version", "value": "1.4.0" },
{ "op": "add", "path": "/tools/2", "value": "c" }
]Other JSON tools on JSON FYI
Every flow you need — formatter, validator, viewer, pretty print, repair, and the full workbench.
Pretty-print with custom indent and sort keys.
Strict RFC 8259 syntax check with line + column.
Browse JSON as an interactive collapsible tree.
Convert arrays into spreadsheet-ready CSV.
Well-formed XML with attributes and indenting.
Idiomatic YAML 1.2 for Kubernetes & Compose.
Beautify JSON with JS- or Python-style indent.
Free in-browser formatter — nothing uploaded.
Pinpoint errors with a catalog of common fixes.
Validate data against a JSON Schema — powered by Ajv.
All tools in one editor: validate, format, view, query.