Skip to content

Compare view

The Compare view lists the differences between two JSON values as JSON Patch operations, with both values side by side. The left side is the open document, or the node selected in it. The right side is JSON you paste, another file, or a second node.

The Compare view is available for JSON files. Select Compare in the view switcher.

Choose what to compare the document with:

  • Pasted JSON: paste the text into the box, or select Paste from clipboard, then select Compare.
  • Another file: select Compare with file… and choose a JSON file. NDJSON files cannot be compared.
  • Another node: in the Tree view, select two nodes, the first with a click and the second with Ctrl+click. Then press Ctrl+Shift+D or choose Diff Selected Nodes from the Node menu or the context menu. The comparison runs at once, with the first node on the left. This works in JSON files only.

For pasted JSON and files, the left side is the node selected in the tree, or the whole document when no node is selected.

Each side can be at most 50 MiB; see Limits. To compare something else, select New comparison.

The two values appear side by side, indented, with line numbers. Sync scroll, on by default, scrolls both panes together.

Below them, the Patches list has one row per difference, with its operation, its path as a JSON Pointer, and the new value:

Operation Means
add The right side has a member or element the left side lacks
remove The left side has a member or element the right side lacks
replace The value at the path differs

Select Prev and Next, or click a row, to step through the differences.

Objects are compared by key, so the order of keys never counts as a difference. Arrays are compared by position: an element inserted near the start of an array shows as a change at every later position.

Ignore whitespace hides the differences between two strings that differ only in leading or trailing spaces. It changes the list only: when differences are hidden, the count shows the total in parentheses.

Copy as JSON Patch copies every difference as an RFC 6902 JSON Patch, including differences hidden by the options. Applying that patch to the left side produces the right side.

Apply to document makes the left side of the open document match the right side, as one edit you can undo. It opens the Apply JSON Patch dialog with the patch filled in; review it and select Apply. The button appears only when the document can be edited. See Apply a JSON Patch.