{}JSON FYI
Diff

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.

Original (left)
Updated (right)

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

Configuration drift
Input
{
  "limits": { "maxDepth": 32, "maxFileMb": 10 },
  "tools": ["validator", "formatter"]
}
Output
{
  "limits": { "maxDepth": 64, "maxFileMb": 10 },
  "tools": ["validator", "formatter", "diff"]
}

Spot the value change at limits.maxDepth and the new tool added at tools[2].

API regression check
Input
{ "id": 1, "name": "Ada", "active": true }
Output
{ "id": 1, "name": "Ada", "active": true, "createdAt": "2025-01-01" }

An additive change — new field, no breakage. The diff highlights the addition explicitly.

Unchanged after reformat
Input
{"a":1,"b":2,"c":3}
Output
{
  "c": 3,
  "b": 2,
  "a": 1
}

Different whitespace, different key order — but the same JSON. The diff shows zero changes.

Use cases

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.

Compute a JSON Patch (RFC 6902) between two documents

Read two JSON files and emit the standard JSON Patch operations needed to transform one into the other.

npm i fast-json-patch && node diff.js
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));
Input
{ "version": "1.3.0", "tools": ["a", "b"] }
{ "version": "1.4.0", "tools": ["a", "b", "c"] }
Output
[
  { "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.

Related tools & guides