ToolNimba Browse

🔀 JSON Diff Checker

By ToolNimba Web Dev Team · Updated 2026-06-19

Paste JSON into both boxes and press Compare.

A JSON diff compares two JSON values and tells you exactly what changed between them: which keys were added, which were removed, and which values were modified. Paste your original JSON in the left box and the changed version on the right, and this tool walks both structures recursively and lists every difference with the precise path to it, such as user.roles[1] or config.timeout. Everything runs in your browser, so even sensitive payloads never leave your machine.

What is the JSON Diff?

JSON (JavaScript Object Notation) is a tree of objects, arrays and primitive values. Two JSON documents can look almost identical yet differ in ways that are hard to spot by eye: a single flipped boolean, a number that became a string, or a key that quietly disappeared from a nested object. A JSON diff solves this by parsing both sides into real data structures and then comparing them node by node, rather than comparing the raw text. That means cosmetic differences like indentation, spacing or trailing newlines do not register as changes, only genuine structural and value differences do.

This tool classifies every difference into one of three kinds. An added key exists in B but not in A. A removed key exists in A but not in B. A changed value is a leaf (a string, number, boolean or null) that is present on both sides but holds a different value, or whose type changed (for example the number 1 becoming the string "1"). Each difference is reported with a dotted, bracketed path so you can locate it instantly in the source, for example items[0].price or meta.tags[3].

Arrays are compared position by position, which is the simplest correct approach: index 0 in A is compared to index 0 in B, and so on. If B has more elements, the extras are reported as added; if A has more, the extras are reported as removed. This is predictable and fast, though it means inserting an item at the front of a long array will show many positions as changed rather than as a single insertion. For configuration files, API responses and small to medium payloads, positional comparison is exactly what you want.

When to use it

  • Reviewing what changed between two API responses while debugging an integration.
  • Comparing a config file before and after an edit to confirm only the intended keys moved.
  • Checking two versions of a JSON fixture or snapshot in a test suite.
  • Spotting an accidental type change, such as a numeric id that became a quoted string.
  • Auditing a settings export against a known-good baseline to find drift.

How to use the JSON Diff

  1. Paste the original JSON into the left box (A).
  2. Paste the changed JSON into the right box (B).
  3. Press Compare, or just edit either box to compare as you type.
  4. Read the added, removed and changed counts, then scan the table for each path.
  5. Use Swap sides to reverse the comparison, or Load sample to see an example.

Formula & method

For each node, compare A and B. If both are objects, compare every key: a key only in A is removed, a key only in B is added, a shared key is compared recursively. If both are arrays, compare by index. If they are leaves and differ in value or type, record a change. Path notation: object.key and array[index].

Worked examples

A = {"name": "Ada", "age": 36, "active": true} and B = {"name": "Ada", "age": 37, "city": "London"}.

  1. name is "Ada" in both, so no difference.
  2. age is 36 in A and 37 in B, both present, value differs: Changed at path age (from 36 to 37).
  3. active is true in A but absent in B: Removed at path active.
  4. city is "London" in B but absent in A: Added at path city.

Result: 1 added (city), 1 removed (active), 1 changed (age).

A = {"roles": ["admin", "editor"]} and B = {"roles": ["admin", "viewer"]}.

  1. roles is an array on both sides, so compare by index.
  2. roles[0] is "admin" in both: no difference.
  3. roles[1] is "editor" in A and "viewer" in B: Changed at path roles[1] (from "editor" to "viewer").

Result: 0 added, 0 removed, 1 changed (roles[1]).

The three kinds of difference this tool reports

KindMeaningShown in From (A)Shown in To (B)
AddedKey or index exists in B but not in A-the new value
RemovedKey or index exists in A but not in Bthe old value-
ChangedPresent on both sides but value or type differsold valuenew value

How paths are written

StructureExample pathReads as
Top-level keyagethe age field
Nested objectuser.profile.emailemail inside user.profile
Array elementroles[1]the second item of roles
Nested array of objectsitems[0].priceprice of the first item

Common mistakes to avoid

  • Expecting key order to count as a difference. Objects are compared by key, not by the order the keys appear, so reordering fields in B does not register as a change. This matches how JSON objects actually work: {"a":1,"b":2} and {"b":2,"a":1} are equal.
  • Confusing a value change with an add plus a remove. If a key is present on both sides with different values, that is a single Changed row, not a Removed plus an Added. A key only counts as added or removed when it is missing entirely from one side.
  • Assuming arrays are matched by content. Arrays are compared by position, so inserting an item at the start can show many later positions as changed. If you need order-independent matching, sort both arrays the same way before comparing.
  • Pasting JSON5 or JavaScript object literals. The parser is strict JSON: keys must be in double quotes, no trailing commas, no comments, and no single quotes. If you see a parse error, run the text through a JSON formatter first.

Glossary

JSON
JavaScript Object Notation, a text format for structured data made of objects, arrays, strings, numbers, booleans and null.
Key
The name of a field inside a JSON object, always a double-quoted string.
Path
A dotted and bracketed address that points to one node in the tree, such as user.tags[2].
Leaf
A value with no children: a string, number, boolean or null, as opposed to an object or array.
Diff
The set of differences between two values, here grouped into added, removed and changed.

Frequently asked questions

How do I compare two JSON files?

Open each file, copy its contents, and paste one into the left box and the other into the right box. The tool parses both and lists every added key, removed key and changed value with its path. You can also edit either side to see the diff update as you type.

Does the order of keys matter?

No. JSON objects are unordered by definition, so this tool compares objects by key rather than by position. Reordering the fields in one document will not show up as a difference. Array elements, however, are compared by index, so their order does matter.

How are arrays compared?

Arrays are compared position by position: index 0 against index 0, index 1 against index 1, and so on. Extra elements on the B side are reported as added, and extra elements on the A side are reported as removed. This is simple and predictable, though inserting an item at the front can mark later positions as changed.

What counts as a changed value?

A value is changed when the same key or index exists on both sides but the values differ, either in value (36 vs 37) or in type (the number 1 vs the string "1"). The tool quotes strings in the output so you can tell 1 and "1" apart at a glance.

Is my JSON sent to a server?

No. The entire comparison runs in your browser using built-in JSON parsing. Nothing you paste is uploaded, logged or stored, which makes the tool safe for private API payloads, config files and other sensitive data.

Why am I getting an invalid JSON error?

The parser follows strict JSON rules: every key must be in double quotes, strings use double quotes, and trailing commas, comments and single quotes are not allowed. The error message points to roughly where parsing failed. Formatting the text with a JSON formatter first usually reveals the problem.