Skip to content
cosmodev ~/tools/json-diff

Trình so sánh JSON

Data & DevOps

So sánh hai tài liệu JSON theo cấu trúc: các giá trị được thêm, loại bỏ và thay đổi được báo cáo tại đúng đường dẫn thay vì các dòng văn bản thô. Chạy hoàn toàn trong trình duyệt của bạn, kèm liên kết chia sẻ.

Danh sách thay đổi
Danh sách thay đổi có thể sao chép sẽ xuất hiện tại đây.

(Tài liệu bằng tiếng Anh)

What it does

Compares two JSON documents structurally — by parsed value, not by text. Every difference is reported at its exact path ($.users[1].name) as added, removed or changed, with the before and after values shown. Key order and formatting differences are ignored: {"a":1,"b":2} and {"b":2,\n "a":1} are identical. Bad input never crashes the view — a parse error is reported with the offending side named. Everything runs locally in your browser.

How to use it

  1. Paste the original into Left JSON and the changed version into Right JSON, or tap Sample on either side.
  2. The change list (right) colors each difference: green + added, red − removed, accent ~ changed. Badges at the top count each kind.
  3. When both sides parse equal, the tool says so — structurally identical, no changes.
  4. Copy change list takes a plain-text version (~ $.name: "ada" → "grace"), ready for a commit message or review comment.
  5. Copy share link encodes both documents in the URL.

Examples

A scalar change:

{"name": "ada"} vs {"name": "grace"} → ~ $.name: "ada" → "grace"

A key added:

{"keep": 1} vs {"keep": 1, "new": 3} → + $.new: 3

An array that grew:

[1, 2] vs [1, 2, 3] → + $[2]: 3

A type change reports one change at the diverging path, not one per child:

{"a": {"x": 1}} vs {"a": [1]} → ~ $.a: {"x":1} → [1]

How structural diffing works

The walk is path-precise and array indexes are compared positionally — no move detection. A shifted array ([1,2,3] → [3,1,2]) reports every index as changed, because positionally, it is. If you need key-based row alignment for tabular data, use CSV Diff with a key column.

Situation Report
Key on the right only added at $.key
Key on the left only removed at $.key
Same path, different scalar changed, before and after shown
Same path, different kind (object vs array) one change at that path
Array longer / shorter added / removed per extra index
Mã nguồn14 ngôn ngữ

100% phía client · dữ liệu của bạn không bao giờ rời khỏi trình duyệt. Thấy hữu ích? Chia sẻ với đồng nghiệp của bạn.