跳到主要内容

JSON 结构比对

UpBox优盒工具箱,免费在线 JSON 结构比对:贴两份 JSON,按路径逐项对比并列出新增、删除、修改的字段,数组下标与嵌套层级都清楚显示,适合接口联调与回归核对。

无需注册 · 数据不上传No sign-up · nothing uploaded

两份 JSONTwo payloads

只比结构和值,不比格式;数组按位置逐个比,长度变了会单独标出一条;两边都必须是合法 JSON

差异Differences

两边各贴一段 JSON

路径用点号表示层级,数组下标写成 [0];新增是右边才有、删除是左边才有、修改是两边都在但值或类型变了

本工具所有运算在本地浏览器完成,你的文件、文本不会上传到服务器

工具介绍

接口改字段、配置换版本,最怕的是「看起来一样、其实差一个值」;肉眼看两份 JSON 基本等于凭记忆。 When an API changes or a config gets a new version, the risky case is "looks the same but one value differs" — eyeballing two payloads is basically trusting memory.

这里把两边压平成路径逐个比,只列出真正不同的那几行,新增、删除、修改分别标色,一眼就能看出这次改了什么。 Both sides are flattened into paths and compared item by item, so only the rows that truly differ are listed, colour-coded by added, removed and changed.

  • 路径级对比Path-level diff
  • 三色标记Colour coding
  • 数组下标Array indexes
  • 可复制清单Copyable list

使用说明

  1. 左边贴原始 JSON。Paste the original JSON on the left.
  2. 右边贴新 JSON。Paste the new JSON on the right.
  3. 看差异清单与计数。Read the list and counts.
  4. 需要时复制差异。Copy the diff if needed.

常见问题

会按格式逐行比吗?Does it compare line by line?
不会,比对的是解析后的结构和值,缩进、换行、键的顺序都不影响结果。No, it compares parsed structure and values, so indentation, line breaks and key order do not matter.
数组怎么比?How are arrays compared?
按位置逐个比:`tags[2]` 只在右边有就是新增;长度不同会额外标一条 `tags Array(2) → Array(3)`。By position: a `tags[2]` that exists only on the right is added; a length change also produces a `tags Array(2) → Array(3)` row.
类型变了算修改吗?Does a type change count?
算,例如 399 变成 "399",会标成修改并同时显示两种形态。Yes: 399 becoming "399" is a change and both forms are shown.
数据量大能跑吗?Does it handle large payloads?
几 MB 的 JSON 没问题,但会展开成很多路径;超大文件建议用命令行 jq 或 diff。A few megabytes is fine though it expands into many paths; for very large files use jq or diff on the command line.
广告位

此处为广告位,可放置你的推广素材

支持图片、文字或 HTML 代码,替换本区块内容即可投放

浏览其他分类