Skip to content
gohacks.dev
APIs

JSON Diff

Compare two JSON documents by structure and list every added, removed and changed value with its JSONPath, ignoring key order and whitespace.

Free · No sign-up · Your inputs stay in your browser

Input

Compare two JSON documents

Output

6 differences

PathChangeBeforeAfter
$.versionchanged"1.4.0""1.5.0"
$.replicaschanged23
$.env.LOG_LEVELchanged"info""debug"
$.env.CACHEremoved"redis"
$.env.QUEUEadded"sqs"
$.ports[2]added9000

Compared by structure, so key order and whitespace never count as a change, and paths are written in JSONPath so they can be pasted into the JSONPath tester.

Runs in this browser. Nothing you paste is sent to a server.

Why not a text diff?

Two API responses with the same data can differ in key order and whitespace, and a line diff reports both. Comparing parsed structures shows only real changes, and reports them as paths such as $.env.LOG_LEVEL, which say what changed without reading the context.

Arrays

By default arrays are compared position by position, so inserting one element at the start makes every later one look changed. 'Ignore array order' compares them as sets instead, which suits lists of tags or permissions but hides real reordering. For lists of records with IDs, sort both by ID first.

Share

Frequently asked questions

Does key order matter?
No. JSON objects are unordered by definition (RFC 8259), so the diff compares keys by name.
Can I diff on the command line?
jq can normalise both sides first: diff <(jq -S . a.json) <(jq -S . b.json) sorts keys so a plain diff shows only real changes.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools