Why compare JSON by structure instead of as text?
A text diff reports every line that moved. JSON objects are unordered by definition, so two API responses can hold exactly the same data while a line-by-line diff shows dozens of changes because a serializer printed the keys in a different order. This tool parses both documents and compares them key by key and value by value.
{
"id": 42,
"price": 19.99,
"tags": ["new", "sale"]
}{
"tags": ["sale", "new"],
"price": "19.99",
"id": 42
}A text diff marks almost every line. This tool reports one difference: $.price changed type from number to string. The moved keys and the re-ordered tags array are treated as the same data.
How the comparison works
- Objects are matched by key name. Order never matters. Keys only in A are removed, keys only in B are added.
- Data types are compared on every value.
"1"vs1,"true"vstrueor an object replaced by an array are reported as type changed, separately from plain value changes. - Numbers are compared by value with exact decimal arithmetic, so
1.50,1.5and15e-1are equal and large IDs keep full precision. Turn on the integer-vs-decimal option if1vs1.0matters to you. - Arrays are order-insensitive by default. Objects in arrays are paired by a key field such as
id,_id,uuid,key,skuornamewhen every item has a unique one, then by identical content, then by closest match, so an edited record shows as a field change instead of a removal plus an addition. Choose By position when order is meaningful, such as coordinates. - Duplicate keys are flagged. Like most parsers, the last value wins.
- Parse errors point to the exact line and column with a plain-English reason: trailing commas, single quotes, missing commas, comments,
NaN, smart quotes and more.
JSON Schema validation
Add a schema and one or more JSON files. Each file gets a pass or fail, with every error listed by instance path, the failing keyword and its schema location. Clicking an error highlights the value in the document. The $schema URL picks draft-specific rules; without it, 2020-12 rules apply.
| Area | Supported keywords |
|---|---|
| Any value | type enum const allOf anyOf oneOf not if/then/else $ref $defs definitions $id $anchor, boolean schemas |
| Numbers | minimum maximum exclusiveMinimum exclusiveMaximum (number and draft-04 boolean forms) multipleOf |
| Strings | minLength maxLength (counted in characters) pattern (ECMA-262 regex) format |
| Arrays | items prefixItems additionalItems contains minContains maxContains minItems maxItems uniqueItems |
| Objects | properties required additionalProperties patternProperties propertyNames minProperties maxProperties dependentRequired dependentSchemas dependencies |
The schema itself is checked too: unknown keywords (with a suggestion for likely typos such as requried), invalid type names, invalid regular expressions and $ref targets that don't exist are listed above the results.
Use it from a browser agent (WebMCP)
This page registers two WebMCP tools, compare_json and validate_json_schema. An AI agent running in Chrome 149 or later can call them directly with the JSON as input and get the differences or validation errors back as text. The call runs the same engine in your tab, so the JSON is still not uploaded. In other browsers nothing changes. The WebMCP page lists the inputs and shows how to test the tools yourself in the console.
What it doesn't do
- Remote
$refURLs are not fetched, because nothing leaves your browser. Put shared definitions under$defsin the same schema. unevaluatedProperties,unevaluatedItemsand$dynamicRefare not evaluated. You get a notice when a schema uses them.- Case-insensitive comparison folds AโZ only; accented letters are compared exactly.
- Very large files (hundreds of MB) are limited by the memory of your browser tab.
FAQ
Is my JSON uploaded anywhere?
No. The page downloads a small engine once, then every step runs on your device. You can disconnect from the internet after the page loads and it keeps working.
Why are two keys in a different order not a difference?
The JSON specification defines an object as an unordered collection of name/value pairs. Programs that read JSON don't depend on key order, so a reordered object carries the same data. The summary still tells you how many objects had reordered keys.
How do I compare arrays where order matters?
Set Array items to By position. Item 0 is compared with item 0, item 1 with item 1, and extra items are reported as added or removed.
Can I ignore fields like timestamps or request IDs?
Yes. List the key names under Ignore these keys. They are skipped at every depth, in both documents.
Can an AI agent use this tool?
Yes, in Chrome 149 or later. The page exposes its compare and schema-validation functions as WebMCP tools that a browser agent can call directly. See the WebMCP page for the tool names, inputs and a test you can run.
How big can the files be?
Tens of megabytes compare in well under a few seconds on a typical laptop. Files over 2 MB are kept out of the text box so the page stays responsive, and are still compared in full.