TToolbox
⇄

JSON Diff

Compare two JSON structures

About this tool

Comparing differences across microservice payloads, database schema dumps, and configuration updates is a constant necessity in software engineering. However, naive line-by-line text diffing fails on JSON because unordered object keys and formatting variations register as false positives. This tool performs semantic structural JSON diffing, parsing abstract syntax trees to ignore key ordering while precisely highlighting added keys, deleted fields, and mutated values.

How to Use This Tool (Step-by-Step)

1

Paste Both JSON Payloads

Paste your baseline JSON payload into the left editor and the updated response or schema into the right editor.

2

Execute Semantic Diffing

The parser normalizes key ordering and whitespace across both structures, eliminating false positives caused by property sequence.

3

Inspect Highlights & Export Diffs

Green highlights new fields, red flags deleted properties, and amber indicates altered values. Collapse unchanged nodes with one click.

Key-Order Independent Diffing

Sorts object keys alphabetically prior to comparison, preventing false diff warnings when two JSON objects contain identical data in different sequence.

Recursive Deep Nested Traversal

Recursively compares deep hierarchical structures and array indices, identifying the exact dot-path of mutated attributes.

100% Client-Side Air-Gapped

Parsing and diff calculations run entirely inside local browser sandbox memory. Confidential production API traces remain completely private.

JSON Comparison Best Practices & Tips

  • •Verify syntax validity first: Mismatched quotes or trailing commas prevent AST parsing. Look for syntax alert banners indicating broken JSON.
  • •Arrays are ordered; Objects are unordered: Reordered object keys represent identical data; however, reordered array elements are true mutations.
  • •Collapse unchanged nodes: When comparing massive multi-megabyte payloads, enable 'Collapse Identical' to focus on mutations immediately.

Code & Transformation Examples

Semantic JSON Equality Despite Key Reordering

Payload A
{
  "id": 101,
  "name": "Alice",
  "active": true
}
Payload B
{
  "active": true,
  "name": "Alice",
  "id": 101
}

* Standard text diffs flag all lines as mutated; our semantic diff correctly reports zero changes.

API Payload Mutation Diff Benchmark

API v1 Response
{
  "status": "success",
  "code": 200,
  "user": { "role": "member" }
}
API v2 Response
{
  "status": "success",
  "code": 200,
  "user": { "role": "admin" }, // 修改 (amber)
  "token": "xyz_123" // 新增 (green)
}

* Isolates the mutation in `user.role` and highlights the newly added `token` attribute.

Frequently Asked Questions

Q: Does it detect type mutations like number 1 vs string '1'?

A: Yes. JSON is strictly typed. The tool checks both value and type (Number, String, Boolean, Null), flagging type drift mutations clearly.

Q: Can diffs be exported as standard RFC 6902 JSON Patch?

A: Yes. Diffs can be exported as RFC 6902 JSON Patch arrays (containing add, remove, and replace ops), ideal for automated REST API updates.

Q: Will diffing large multi-thousand-line configs freeze the browser?

A: Virtualized rendering pipelines and optimized tree-walking engines process tens of thousands of lines in hundreds of milliseconds without UI stutter.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/