JSON差异对比
递归比较两份 JSON,标出新增/删除/修改。
关于「JSON差异对比」
它属于「JSON 工具」分类:JSON 的格式化、结构变换与各种数据格式互转。
- 递归比较两份 JSON 的每一个字段,精确定位到具体路径。
- 差异分为三类:右侧独有为新增,左侧独有为删除,两侧都有但值不同为修改。
- 路径采用
a.b[0].c形式,可直接对照原始数据查找。 - 输入内容变化时会自动重新对比,也可以点按钮手动触发。
- 若两侧键顺序不同造成干扰,可先用「JSON键名排序」统一顺序。
完全免费、无需注册;所有处理都在浏览器本地完成,文件不会上传到任何服务器。
相关关键词:JSON差异对比、JSON 工具、diff、对比、比较、在线工具、免费
如何使用「JSON差异对比」
- 打开工具:打开「JSON差异对比」页面,无需注册、无需安装任何软件。
- 准备输入:把两份 JSON 分别粘贴到左右编辑框,递归比较并标出新增、删除与修改。
- 填入内容:把内容粘贴进输入框,或把文件拖入页面;也可以点击「示例」先填入样例数据试一下。
- 设置选项并处理:按需调整页面上的选项,然后点击处理 / 转换 / 生成按钮。
- 获取结果:处理完全在浏览器本地完成,结果可直接复制或下载,文件不会上传到任何服务器。
常见问题
- 和普通文本对比有什么不同?
- 文本对比会把换行、缩进、键的书写顺序都算作差异,噪音很大。这里是按数据结构逐字段比较,只报告真正的语义差异。
- 数组是怎么比较的?
- 按下标逐位比较。因此在数组中间插入一个元素,会导致后续所有位置都被判定为修改,这属于预期行为。
- 能对比很大的文件吗?
- 可以,但差异条目过多时表格渲染会变慢。建议先缩小到关注的子结构再做对比。
JSON Diff
Recursively compare two JSON documents, marking add/delete/change.
About JSON Diff
Belongs to “JSON Tools”: Format, transform and convert JSON to and from various data formats.
- Recursively compares every field of two JSONs, pinpointing the exact path.
- Three kinds of diffs: unique to the right is added, unique to the left is removed, present on both but different is changed.
- Paths use the
a.b[0].cform, so you can locate them directly in the source. - Edits trigger an automatic re-compare, or you can click the button to run it manually.
- If differing key order is noisy, unify order first with the “JSON key sort” tool.
Free, no sign-up; everything runs locally in your browser and files are never uploaded.
Keywords: JSON Diff, JSON Tools, diff, comparison, compare, online tool, free
How to use JSON Diff
- Open the tool:Open the “JSON Diff” page — no sign-up and nothing to install.
- Prepare the input:Paste two JSON documents into the left and right editors for a recursive diff that marks additions, deletions and changes.
- Provide the input:Paste your content into the input box or drop a file onto the page; you can also click “Sample” to try example data first.
- Adjust options and run:Adjust the options if needed, then click the process / convert / generate button.
- Get the result:Everything runs locally in your browser; copy or download the result — your files are never uploaded.
FAQ
- How is this different from text diff?
- Text diff treats newlines, indentation and key order as differences, producing huge noise. Here we compare field by field by data structure, reporting only real semantic diffs.
- How are arrays compared?
- Compared by index position. Inserting an element in the middle marks all later positions as changed — expected behavior.
- Can it compare very large files?
- Yes, but rendering slows when there are too many diff rows. Narrow to the relevant sub-structure first.