JSON Schema Generator & Validator

Create a starting JSON Schema from an example, or check that a JSON document matches a schema you already have.

Two tools in one

Generate reads a sample JSON document and produces a matching schema you can refine. Validate checks JSON data against a schema and reports whether it conforms.

Refine the result

A schema generated from one example only knows what that example contained, so add required fields, formats and limits yourself.

How to use it

  1. To generate: paste JSON into the first box and press Generate Schema, then Copy.
  2. To validate: paste the data and the schema into the two boxes and press Validate.

Validation example

This data and schema:

Data:   {"name":"John"}
Schema: {"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}

match, so validation passes.

Common use cases

What the generator produces

The output declares http://json-schema.org/draft-07/schema# and describes each value by its type. Objects get a properties map and a required list containing every key found in the sample. Whole numbers become integer, other numbers number, and arrays get an items schema based on the first element only. An empty array becomes {"type":"array","items":{}}.

Input:   {"id": 7, "price": 9.5, "tags": ["a"], "note": null}

Output properties:
  id    -> integer
  price -> number
  tags  -> array of string
  note  -> null
required: id, price, tags, note

Edit the draft before you rely on it

Treat the generated schema as a skeleton. Common edits are: remove keys from required that are really optional, change a null type to ["string", "null"] when the field can be either, add enum for fixed vocabularies such as status codes, and add minimum, maximum, minLength or maxLength where you know the limits. If the first array element is not typical (for example it has a missing field), pick a better sample before generating.

What the validator checks

The Validate box implements a practical subset of JSON Schema: type (including type lists), required, properties, items, enum, minLength, maxLength, minimum and maximum. Errors are listed with a path such as root[2].price so you can find the offending value. An integer is accepted wherever number is expected.

Keywords outside that list are ignored rather than rejected, so a schema using pattern, format, additionalProperties, oneOf, anyOf, $ref or const can show “valid” for data that a full validator such as Ajv would reject. For production contracts, use this tool for quick checks and keep a full validator in your test suite.

Frequently asked questions

Can the schema be generated from one example?

Yes, but you should review it, because one example cannot show optional fields or value limits.

What if my JSON is invalid?

The tool reports the JSON parse error so you can fix it first.

Is it free?

Yes.

Is my data uploaded?

No. This tool runs entirely in your browser, so what you type or paste is not sent to our servers.

Which JSON Schema draft does the generator target?

Draft-07. The generated schema starts with a $schema line pointing at json-schema.org/draft-07.

Why does the validator say my data is valid when it clearly is not?

The validator only enforces the keywords listed above. Constraints written with pattern, format, additionalProperties, oneOf, anyOf or $ref are skipped, so check those with a full validator.

Related tools

Explore all developer tools →