Skip to content

JSON Schema validator that lists every problem at once

Paste a JSON Schema and see every place your data breaks it, with the path to each value.

Your JSON and your schema are checked on this device and are never uploaded. How your data stays local.

Local
source
result

        
      
Loading the workspace...

JSON Mill's schema validator checks a JSON document against a JSON Schema and lists every problem in one pass: a missing required property, a string where the schema wants an integer, a value outside its enum, a number below its minimum, a property the schema does not allow. Each problem shows the path to the value, such as $[2].total, and its line and column.

It understands drafts 2020-12, 2019-09 and 7, picked from the schema's $schema keyword. The check runs in a background worker in your browser, so API responses, configuration files and customer records never leave your device.

How to validate JSON against a schema

  1. Paste or open your JSON. Paste the document into the source panel or drop a file on the workspace. It has to be valid JSON first; if it is not, JSON Mill shows the syntax error and Repair can fix common mistakes.
  2. Add the schema. Paste the schema into the Schema box, or press Open schema file. No schema yet? Start from this document fills the box with one generated from your data, ready to tighten.
  3. Press Validate document. The result says the document matches, or how many problems were found. Each problem appears under Problems with its path, line, column and a plain message such as Missing required property "email".
  4. Jump to each problem. Select a problem to put the cursor on that value in the editor. In the Tree or Table view it scrolls to the node instead. Fix the data, or adjust the schema, and validate again.

Example: three orders checked against an order schema

Three orders and a draft 2020-12 schema that requires an integer id, a valid email, a known status and a total of 0 or more, with no other properties.

orders.json
[
  {"id": 1001, "email": "ana@example.com", "status": "paid", "total": 42.5},
  {"id": "1002", "email": "ben.example.com", "status": "shipped", "total": 18},
  {"id": 1003, "status": "refunded", "total": -5, "coupon": "FALL10"}
]
order-schema.json (draft 2020-12)
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "array",
  "items": {
    "type": "object",
    "required": ["id", "email", "status", "total"],
    "properties": {
      "id": {"type": "integer"},
      "email": {"type": "string", "format": "email"},
      "status": {"enum": ["paid", "shipped", "refunded"]},
      "total": {"type": "number", "minimum": 0}
    },
    "additionalProperties": false
  }
}
Problems JSON Mill reports
Line 3, column 10: $[1].id: Expected integer, found string
Line 3, column 27: $[1].email: String does not match format "email"
Line 4, column 3: $[2]: Missing required property "email"
Line 4, column 47: $[2].total: -5 is less than 0
Line 4, column 61: $[2].coupon: Property "coupon" is not allowed

The first order passes. The second has its id as a string and an email without an @. The third is missing email, has a negative total and carries a coupon property the schema does not allow. All five problems are reported together, each with the path JSON Mill uses everywhere, so $[2].total means the total of the third order.

Syntax validation and schema validation

A document can be perfectly valid JSON and still be wrong for the program that reads it. The JSON validator answers the first question: can this text be parsed at all? A schema answers the second: does the data have the fields, types and values it is supposed to have?

JSON Mill runs both. The syntax check happens as you type; the schema check runs when you press Validate document, and only on a document that parses.

Keywords that are checked

  • Types and values: type, enum, const, format.
  • Objects: properties, required, additionalProperties, patternProperties, propertyNames, dependentRequired, dependentSchemas, unevaluatedProperties.
  • Arrays: items, prefixItems, contains, minItems, maxItems, uniqueItems, unevaluatedItems.
  • Numbers and strings: minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, minLength, maxLength, pattern.
  • Combining schemas: allOf, anyOf, oneOf, not, if, then, else, and $ref to $defs or definitions in the same schema.

Options

Settings in the workspace that matter for this job
Option What it does
Validate document Checks the document against the schema and lists every problem under Problems. For JSON Lines, each line is checked as its own record and paths start with the record number.
Open schema file Loads a schema from a .json file on your device into the Schema box.
Start from this document Generates a draft 2020-12 schema from the current document and puts it in the Schema box, as a starting point to edit.

Limits

  • Referenced schemas must be inside the schema you paste. A $ref to another file or a web address is reported as a schema error; JSON Mill never downloads it. Copy the definition under $defs instead.
  • $dynamicRef from draft 2020-12 is not followed yet, so the parts of a schema that rely on it are not checked. $recursiveRef from 2019-09 works.
  • Numbers are compared as JavaScript numbers, so a limit such as maximum on an ID longer than 15 digits compares a rounded value. The problem message still shows the number exactly as it is written in your file.
  • Formats such as email, date-time and uri are checked, not just noted. If your schema uses a format loosely, expect problems for values that do not strictly match.
  • The Problems list shows the first 200 problems; the editor marks every one, up to 1,000.

Questions

Which JSON Schema drafts are supported?
Draft 2020-12, draft 2019-09 and draft 7 (draft 6 schemas are checked as draft 7, and draft 4 works too). JSON Mill reads the $schema keyword to choose; a schema without one is treated as 2020-12.
Does it stop at the first problem?
No. Every problem in the document is reported in one pass, so a file with forty bad records shows forty entries. Problems are listed in the order they appear in the file.
What if my schema itself is wrong?
JSON Mill checks the schema before using it. A schema that is not valid JSON, a type such as "int", a required that is not a list or a pattern that is not a valid regular expression is reported with its line and column in the schema, and Show in schema selects it.
Can it follow a $ref to another file or URL?
No. To keep your data on your device, JSON Mill never fetches anything a schema refers to. Put the referenced definitions under $defs in the same schema and point to them with #/$defs/name.
Is my data uploaded?
No. JSON Mill processes your JSON in your browser, in a background worker on your device. Nothing leaves your device unless you choose to save or share a document, which needs an account, and JSON Mill tells you before it sends anything. How your data stays local explains how to check this yourself in your browser's developer tools.

Last updated