JSON Schema Generator & Validator

Generate a JSON Schema from a sample or validate a JSON document against one, right in your browser. Your data never leaves your device.

Schema generation and Ajv validation run locally in your browser, so your JSON sample, schema and document are never uploaded.

Need TypeScript types instead? Try JSON to TypeScript.

About JSON Schema Generator & Validator

This JSON Schema generator turns a JSON sample into a ready-to-use JSON Schema, and the built-in validator checks any JSON document against a schema you provide. In Generate mode it walks your sample, infers types for objects, arrays, strings, numbers, booleans and null, unifies array items, and can mark every property required, set additionalProperties to false, and detect string formats like email, date, date-time, uri and uuid. Pick draft-07 or 2020-12 for the output. In Validate mode it runs Ajv with allErrors and ajv-formats, then lists each failure with its instance path and message. It is built for API developers, backend engineers and anyone defining or testing JSON contracts. Everything runs in your browser, so the sample and schema you paste stay on your device.

Features

How to use the JSON Schema Generator & Validator

  1. Choose Generate to build a schema, or Validate to check a document.
  2. In Generate, paste a JSON sample and toggle required, additionalProperties and format options.
  3. Pick draft-07 or 2020-12, then copy or download the resulting schema.json.
  4. In Validate, paste a JSON Schema on the left and a JSON document on the right.
  5. Read the valid/invalid badge and the list of errors, each with an instance path.

Example

Input

{
  "id": 1,
  "name": "Ada",
  "email": "ada@example.com",
  "tags": ["a", "b"]
}

Output

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "id": { "type": "integer" },
    "name": { "type": "string" },
    "email": { "type": "string", "format": "email" },
    "tags": { "type": "array", "items": { "type": "string" } }
  },
  "required": ["id", "name", "email", "tags"]
}

With required and format inference on, the sample yields a draft-07 schema.

Common errors & troubleshooting

Frequently asked questions

Which JSON Schema draft does the generator use?
Draft-07 by default, with an option for 2020-12. The choice sets the $schema dialect URL on the output and the minor differences between the drafts; the inferred structure is otherwise the same.
How are required properties decided when generating a schema?
By default no property is marked required, so the schema accepts partial objects. Turn on "Mark all properties required" to add every key of each object to its required array.
How does the validator report errors?
It runs Ajv with allErrors enabled, so you get every failure at once. Each error shows the JSON instance path (such as /items/0/id) and a human-readable message, including missing required keys and unexpected additional properties.
Does the generator infer string formats like email or date?
Yes, when "Infer string formats" is on. It checks sample string values against patterns for email, date, date-time, uri and uuid and adds the matching format keyword; values that match none stay as plain strings.
How does it infer the schema for arrays?
It merges the schemas of all array elements into a single items schema. Mixed object elements are merged property-by-property, a key missing from any element drops out of required, and an empty array becomes items:{}.
Is my JSON sample or schema uploaded anywhere?
No. Generation and validation, including Ajv, run entirely in your browser, so the sample, schema and document you paste are processed locally and stay on your device.

Related tools

All ArrayKit tools