TinyPDF logo
Tools โ€บ JSON

JSON Compare & Schema Validator

Compare two JSON documents by their fields, values and data types, not as plain text. Keys that moved up or down are treated as the same. Validate JSON files against a JSON Schema in the same place.

๐Ÿ”’ Your JSON stays on your device. Parsing, comparing and schema checks run in your browser. Nothing is uploaded to a server. Loading engineโ€ฆ

๐Ÿค– New: AI agents in Chrome can call this tool directly through WebMCP. See how to test it.

  1. Paste, drop or upload JSON A (original) and JSON B (changed).
  2. Choose how arrays are matched and what to ignore under Options.
  3. Press Compare. Differences are listed by path and highlighted side by side.
  4. For schema checks, open the Validate tab, add a schema and one or more JSON files.
JSON Aoriginal
Waiting for JSON
JSON Bchanged
Waiting for JSON
Comparison options
Items are paired by id/_id/uuid/key when present, then by identical content, then by closest match.
Key names, comma-separated. Ignored at every depth.
Ctrl/โŒ˜ + Enter to compare

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.

JSON A
{
  "id": 42,
  "price": 19.99,
  "tags": ["new", "sale"]
}
JSON B
{
  "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

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.

AreaSupported keywords
Any valuetype enum const allOf anyOf oneOf not if/then/else $ref $defs definitions $id $anchor, boolean schemas
Numbersminimum maximum exclusiveMinimum exclusiveMaximum (number and draft-04 boolean forms) multipleOf
StringsminLength maxLength (counted in characters) pattern (ECMA-262 regex) format
Arraysitems prefixItems additionalItems contains minContains maxContains minItems maxItems uniqueItems
Objectsproperties 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

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.

๐Ÿค– Use this tool from an AI agent (WebMCP)

This page offers 2 tools that an AI agent running in the browser can call directly, without clicking through the page. A call runs in your tab like the buttons do, and nothing is uploaded.

How to turn it on and try it

  1. Use Chrome 149 or later on a computer. TinyPDF.in is enrolled in Chrome's WebMCP trial, so there is nothing to switch on.
  2. Keep this page open and open the console (F12, then Console).
  3. Paste this:
const tools = await document.modelContext.getTools();
const tool = tools.find(t => t.name === 'compare_json');
await document.modelContext.executeTool(tool, JSON.stringify({
  "json_a": "{\"id\":1,\"price\":19.99}",
  "json_b": "{\"price\":\"19.99\",\"id\":1}"
}));

In other browsers the page works as usual and offers no agent tools. Examples for every tool and what they return

Using a desktop agent such as Claude Code or Cursor? See how to connect it to this page.