跳转到主要内容
CuteJSON
↑↓ 导航 Enter 选择 Esc 关闭

JSON Merge

Combine two documents into one, see exactly which values disagreed and who won, or generate the RFC 7386 patch that turns one into the other.

返回所有工具

键盘快捷键

这些快捷键在页面上对应操作存在时有效。

打开命令面板
Ctrl/Cmd + K
运行主要操作
Ctrl/Cmd + Enter
格式化
Ctrl/Cmd + Shift + F
压缩
Ctrl/Cmd + Shift + M
复制输出
Ctrl/Cmd + Shift + C
打开文件
Ctrl/Cmd + Shift + O
下载输出
Ctrl/Cmd + S
关闭此对话框
Esc
打开此对话框
F1 / ?

本地数据

以下所有内容仅存储在此浏览器、此设备上。

未保存的草稿
记住选项的工具

最近打开的文件

    此设备上尚未打开任何文件。

    通过链接分享

    内容被打包在链接 # 号之后的部分。

    分享此页面上的第一个输入。

    暂无可分享的内容。

    Left document

    从 URL 加载

    直接从浏览器获取 URL。

    Right document

    从 URL 加载

    直接从浏览器获取 URL。

    Result

    The result appears here.

    Conflicts

    Points where the two sides disagreed appear here.

      完全在您的浏览器中运行。

      关于此工具

      Merging two documents means deciding, key by key, what the result should hold when both sides have something to say about it. Deep merge recurses into a nested object present on both sides and combines it the same way; shallow merge treats a shared key as a single unit and lets one side replace the other wholesale, however deep that value goes. Where the two sides genuinely disagree, a priority setting decides which one is kept, right by default, since applying a second document on top of a first is the more common reading. Arrays are not objects, so they get their own choice: replace lets priority decide which array survives, concatenate appends the right array after the left one, concatenate unique does the same and then drops anything already equal to an earlier entry, and merge by key treats both arrays as tables, matching elements by one field and merging the matches while appending whatever had no match on either side. A conflict is reported only where a value was actually discarded, never for a key only one side had, and never for two numbers that just happen to be written differently, 1 and 1.0 read as the same value everywhere on this site. Generating a merge patch is a different operation with a fixed algorithm, RFC 7386, rather than the options above: it produces the smallest document that, applied to the left side by any conforming implementation, turns it into the right side. A key the left side had and the right side does not becomes null in the patch, which is also, unavoidably, what a key genuinely set to null becomes: the standard itself cannot tell the two apart, and this page cannot either.

      使用方法

      1. Paste the left document, the one being merged into, on the left, and the one being applied on top of it on the right. Load the sample to see a conflict, an addition and a combined nested object at once.
      2. Choose deep or shallow merge, which side wins a real conflict, and how arrays at the same path should be combined.
      3. Press Merge. The result is on the right, and every point where a value was actually discarded is listed below it with both sides and which one was kept.