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

JSON Patch Playground

Work with RFC 6902 patches: apply one to a document, write one from two documents, or turn one around so it undoes itself.

返回所有工具

键盘快捷键

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

打开命令面板
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 / ?

本地数据

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

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

最近打开的文件

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

    通过链接分享

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

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

    暂无可分享的内容。

    Document

    从 URL 加载

    直接从浏览器获取 URL。

    Patch

    从 URL 加载

    直接从浏览器获取 URL。

    Result

    The result appears here.

    Affected paths

    The paths a patch touches appear here.

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

      关于此工具

      A JSON Patch is a list of operations that turns one document into another. RFC 6902 defines it, and APIs that accept partial updates ask for it. This page does the four things that list is actually used for. Apply runs a patch against a document and prints the result. Generate compares two documents and writes the patch that turns the first into the second. Reverse runs a patch and writes the patch that undoes it, which needs the original document, because a remove says what to delete and not what was there. Check reads a patch on its own and reports whether it is well formed, which is the test worth running before sending one anywhere. All six operations are supported: add, remove, replace, move, copy and test. A patch is all or nothing, exactly as the specification requires: if one operation fails then none of them are applied, and the page says which one stopped and why. Values keep the text you wrote them with, so a twenty digit id survives a patch that never mentioned it and 1.0 stays 1.0. Comparison, which is what test asks and what generation uses to decide a value changed, reads 1 and 1.0 as the same number and ignores the order of object keys, while array order is data and is compared position by position.

      使用方法

      1. Paste the document on the left and the patch on the right, or load the sample.
      2. Choose what to do: apply the patch, generate one from two documents, reverse one, or check a patch on its own.
      3. Read the affected paths, then copy or download the result.