Semantic JSON differ that understands JSON structure — shows added, removed, and changed keys with color. Zero dependencies.
Unlike diff, it understands JSON. Unlike jsondiffpatch, it needs no dependencies.
npm install -g json-diffOr without installing:
npx json-diff a.json b.jsonjson-diff old.json → new.json
4 change(s): +2 -1 ~1
+ user.address.zip
"10001"
- user.phone
"555-1234"
~ user.age
28 → 29
~ config.features
["search","export"] → ["search","export","import"]
json-diff a.json b.json # Human-readable diff
json-diff a.json b.json --patch # RFC 6902 JSON Patch output
json-diff a.json b.json --quiet # Exit 1 if different, no output (CI)
json-diff a.json b.json --count # Print number of changes| Symbol | Meaning |
|---|---|
+ |
Key/value added in B |
- |
Key/value removed (was in A) |
~ |
Value changed |
! |
Type changed (e.g. string → number) |
Outputs RFC 6902 compatible JSON Patch:
[
{ "op": "add", "path": "/user/address/zip", "value": "10001" },
{ "op": "remove", "path": "/user/phone" },
{ "op": "replace", "path": "/user/age", "value": 29 }
]- name: Ensure config unchanged
run: json-diff config.json config.expected.json --quietExit code is 1 if any differences are found, 0 if identical.
MIT
json diff · compare json · json compare · json patch · rfc 6902 · diff json files · semantic json diff · json change detection · zero dependencies · cli
Built to solve, shared to help — Rushabh Shah 🛠️✨
One of 40+ zero-dependency developer CLI tools — no node_modules, ever.