Two sides, one honest diff

Compare JSON by structure, not by line noise

A reformatted file makes a line-based JSON diff useless: every line changes and the one real edit hides in the noise. CodePrettify parses both sides and compares values — key order and formatting ignored, array items matched by id — with two editable inputs and everything processed on your device.

  • Semantic and Text modes
  • Key order ignored
  • Arrays matched by id
  • Local processing
CodePrettify JSON compare showing a semantic diff of two JSON documents with the real value changes highlighted
Semantic mode reports changed, added, and removed values while ignoring indentation and object-key order.
Semantic example

One real change, hidden inside a full reformat

The two configurations below differ in key order, indentation, and one actual value. A line diff flags nearly every line; a semantic JSON diff reports exactly what changed.

Left side

Deployed configuration

The version currently running, pretty-printed with keys in their original order.

{
  "service": "checkout",
  "replicas": 2,
  "rollout": {
    "strategy": "RollingUpdate",
    "maxUnavailable": 1
  },
  "regions": ["eu-north-1", "eu-west-1"]
}
Right side

Proposed configuration

Reordered keys and different formatting — but the only value change is replicas.

{
  "rollout": { "maxUnavailable": 1,
    "strategy": "RollingUpdate" },
  "regions": ["eu-north-1", "eu-west-1"],
  "replicas": 3,
  "service": "checkout"
}
Both sides stay on your device.

Comparison is listed among the operations that never leave the extension or the Windows app. Unlike compare-JSON-online tools, nothing you paste is uploaded.

Hands-on tutorial

Compare two JSON payloads step by step

Use the two configurations above, or any pair of payloads you are reviewing. The important habit is checking which side is which before you read added and removed markers.

  1. Open Compare

    Press Ctrl+Alt+D, or choose More Actions → General tools → Compare. The Command Palette (Ctrl+Shift+P) finds it by name as well.

  2. Check the prefilled left side

    The left input starts with the current document and the right input starts empty. Each side has its own Use current document and Clear controls, so you can rebuild either input at any time.

  3. Paste the second version on the right

    Both sides are fully editable. Semantic availability is detected from the two inputs, not from the open file — you can paste two JSON payloads while viewing a JavaScript or CSS document and still get a structured comparison.

  4. Fix the direction with Swap sides

    Before comparing, Swap sides exchanges the actual inputs. Direction matters: an entry reported as added on one orientation is reported as removed on the other.

  5. Run the comparison

    Semantic mode is selected automatically when both inputs parse as JSON, JSONC, JSON Lines, YAML, or TOML — the mode toggle appears only when semantic comparison is possible. Ctrl+Enter runs the open dialog’s primary action.

  6. Read the change set, including its counters

    For the sample, expect a single changed value: replicas from 2 to 3. Change sets are capped at 5,000 entries, and the counters show a trailing ellipsis when truncated. Identical sources show a centered no-differences message instead of an empty list.

  7. Refine without retyping

    After a comparison, Swap Sides flips only which side is displayed; use Edit inputs to change the actual text and compare again. The Windows app adds Previous/Next difference buttons for stepping through a long result.

Before you trust a diff

A comparison is evidence only when you know how it was computed. Confirm these five points.

  • The left/right orientation matches how you read added and removed.
  • The mode is the one you intended — semantic requires both sides to parse.
  • The change counters have no trailing ellipsis, or you accept a truncated list.
  • Arrays you care about carry a shared unique id, _id, uuid, or guid key for identity matching.
  • Very large text comparisons may have used the faster positional fallback.
Two modes

Semantic structure or exact text — the tool tells you which you get

Semantic mode compares parsed values. Text mode compares exact lines with synchronized pane scrolling, and in the Windows app adds an Ignore whitespace option that disregards all whitespace inside lines. When either side fails to parse, the comparison falls back to text.

Side-by-side JSON diff view with the changed values marked between two documents
The result lists what changed; a structured change can jump to the editor line while the source still matches the current JSON document.
JSON compare result shown in the dark theme with the same structural changes highlighted
The comparison view follows the Auto/Light/Dark theme you choose in Settings.
1

Load both sides

Left starts with the current document; paste, edit, clear, or swap either side.

2

Let the mode resolve

Both sides parse as JSON, JSONC, JSON Lines, YAML, or TOML — semantic. Otherwise — text.

3

Navigate the result

Flip the displayed sides, return to Edit inputs, or step differences in the Windows app.

Comparison engine

What the JSON diff engine actually does

Supported structures

  • JSON, JSONC, JSON Lines
  • YAML and TOML
  • Detected from the two inputs
  • Works while viewing any format

In JSON Lines, the app accepts JSONC comments and trailing commas per record; the extension requires strict JSON per line.

Noise it ignores

  • Indentation and line breaks
  • Object-key order
  • Formatting-only rewrites

Only value and structure differences are reported in Semantic mode.

Array identity matching

  • All-object arrays with a unique primitive id, _id, uuid, or guid
  • Same key required on both sides
  • Matched by identity, not position
  • All other arrays compared positionally

Stated limits

  • Change sets capped at 5,000 entries
  • Trailing ellipsis marks truncation
  • Text fallback for invalid inputs

Very large text comparisons — over roughly 5,000 combined lines in the extension, 20,000 in the app — switch to a faster positional comparison that can overstate changes when lines shift.

Careful line jumping

  • Jumps only while a side still exactly matches the current document
  • JSON documents with positionally addressed changes only
  • Identity-matched array changes are listed without a jump

Independently pasted or edited text never produces a misleading jump.

Text mode tools

  • Synchronized pane scrolling
  • Ignore whitespace (Windows app)
  • Previous/Next difference (Windows app)

Compare two files (app)

  • Browse two files from disk
  • Current file prefilled
  • The pair is remembered
  • Dedicated comparison tab

Selecting exactly two supported files in Explorer can expose the Compare command directly.

Decision guide

Read the result for what it is

What you seeWhat it meansBest next action
No Semantic/Text toggleAt least one side does not parse as a supported structured format, so only text comparison is possible.Repair or complete the invalid side, then compare again for a structural result.
Change counter ends with an ellipsisThe change set hit the 5,000-entry cap and the list is truncated.Compare the specific subtree or record range you care about instead of the whole document.
Noisy diff on very large textAbove roughly 5,000 combined lines (extension) or 20,000 (app), the faster positional comparison can overstate changes when lines shift.Compare smaller sections, or use the Windows app for the higher threshold.
Indentation-only line changesThe lines differ only in whitespace, not content.In the Windows app’s Text mode, enable Ignore whitespace; or use Semantic mode when both sides parse.
A reordered array reports many changesThe elements lack a shared unique id, _id, uuid, or guid key, so the array is compared positionally.Keep a stable identifier on both sides to get identity matching.
Centered no-differences messageThe two sources are identical in the selected mode.Nothing to review — swap in the next pair with Use current document or Clear.
FAQ

JSON compare questions

How do I compare two JSON files?

In the extension, open Compare, keep the current document on the left, and paste the second file on the right — each side is fully editable. The Windows app additionally lets you browse two files into a dedicated comparison tab, and selecting exactly two supported files in Explorer can offer a Compare command.

Do key order and formatting affect the JSON diff?

Not in Semantic mode. It compares parsed structure, so reordered object keys, indentation, and line-break differences produce no changes. Switch to Text mode when you specifically need exact line-by-line differences.

What makes the comparison semantic?

Both sides are parsed into structured data and compared value by value instead of line by line. Arrays whose elements are all objects with a unique primitive id, _id, uuid, or guid key on both sides are matched by identity, so a reordered array reports real edits instead of rewriting every position; all other arrays are compared positionally.

Is my JSON uploaded when I compare it?

No. Comparison runs entirely on your device in both the extension and the Windows app. Nothing you paste or open is sent to a server — the practical difference from compare-JSON-online tools.

Related guides

Diff the payloads before you ship the change

Paste both versions, let semantic mode strip away the formatting noise, and review the actual changes on your device.