CruxDevCruxDev Tools Prompts
dev Utility • Zero-Server Privacy • 100% Client-Side

JSON Diff & Compare

Compare two JSON documents structurally and list every added, removed, changed and type-changed value by path, ignoring key order.

Overview

Compares two JSON documents structurally and lists every difference by path: values that were added, removed, changed, or changed type. Key order and formatting are ignored, so only real data changes show up, and you can copy the result as a plain-text report.

How It Works

Paste the original JSON on the left and the changed JSON on the right. If either side is not valid JSON, the parser error appears under that box. Once both parse, the summary shows how many values were added, removed, changed and changed type, and the table lists each difference with its path, such as $.tags[2] or $.user.name, plus the value before and after. An empty result means the documents contain the same data. Copy report copies the list as text for a ticket or code review.

Step-by-Step Usage Guide

  1. Paste the original JSON into the left box.
  2. Paste the new or changed JSON into the right box.
  3. Fix any parse error shown under either box.
  4. Read the differences table, then copy the report if you need to share it.

Technical Specifications & Standards

A line-based text diff is a poor fit for JSON. Reformatting a file, re-indenting it or reordering its keys produces a wall of changed lines even though the data is identical, while a meaningful change can hide inside a long line. This tool parses both documents and walks them as data instead. Objects are compared key by key, so key order never counts as a difference. Arrays are compared by position, which is how JSON defines them: index 0 is compared with index 0, and extra items at the end are reported as added or removed. The trade-off is that inserting an item at the start of an array shifts every later index, so they all show as changed. Sort arrays the same way before comparing if order does not matter in your data. Values are compared with their JSON types. The number 1 and the string "1" are different types, as are null and an empty object, or an array and an object; those cases are reported as type changes rather than plain value changes, because they are often the cause of bugs. Paths use JSONPath-style notation starting at $, and keys that are not simple identifiers, such as content-type, are written in brackets with quotes so the path stays unambiguous. Very large numbers lose precision when parsed, as they do in every JavaScript JSON parser, so two integers longer than 15 or 16 digits can look equal when they are not.

Targeted Use Cases

  • Checking what changed between two API responses when a client starts failing.
  • Reviewing a configuration change before deploying it.
  • Comparing a test fixture with actual output when a snapshot test fails.
  • Confirming that a reformatted or re-serialised JSON file still contains the same data.

Notes & Gotchas

  • Sort arrays of records the same way before comparing if their order is not meaningful.
  • Look at type changes first; a number that became a string is a common cause of client bugs.
  • Remove volatile fields such as timestamps or request IDs to focus on real changes.
  • Keep IDs as strings in JSON if they exceed 15 digits, because larger numbers lose precision when parsed.

Frequently Asked Questions

Does key order matter?

No. Objects are compared key by key, so the same keys in a different order produce no differences.

Why does inserting one array item show many changes?

Arrays are compared by index. Inserting at the front shifts every later item to a new index, so each one is compared with a different item. Sort both arrays the same way first if order does not matter.

What is a type change?

A value whose JSON type changed, such as a number becoming a string, null becoming an object, or an array becoming an object. These are listed separately because they often break code that reads the data.

Is my JSON uploaded anywhere?

No. Both documents are parsed and compared in your browser, and nothing is sent to a server.