Skip to content

Compare

Click Compare (the diff icon) in the explorer toolbar to diff the open document against another JSON document.

The Compare button opens a panel with a text area. You can supply the second document in three ways:

  • Paste JSON into the text area directly.
  • Paste from clipboard to fill the text area automatically. Clipboard access is not available in every VS Code webview context, so pasting into the text area directly always works as a fallback.
  • Choose file… to pick a .json, .jsonl, or .ndjson file from disk. The file is read and diffed immediately; if it cannot be read or is not valid JSON, an error is shown and the dialog stays open so you can try again.

The JSON is validated before the diff runs. If it does not parse, the panel reports the parse error and keeps your text so you can fix it.

Click Compare in the panel and the explorer switches to the diff view. A summary bar reports the totals:

Indicator Meaning
+N added Paths present in the second document but not the first
-N removed Paths present in the first document but not the second
~N changed Paths present in both, with a different value or type
N unchanged Paths that are identical in both

Below the summary, the merged tree marks each node as added, removed, or modified, showing the original and comparison values side by side for changed entries.

Close the diff view to discard the comparison document and return to the tree view. Loading a new document also clears the comparison.