Kadben

JSON to JSON Schema generator

Paste one or more JSON samples to get a JSON Schema that describes them: types, nested objects and arrays, the keys every sample has, and formats such as dates and e-mail addresses.

Runs in your browser. Nothing is uploaded.

JSON to JSON Schema

Options

The JSON Schema appears here.

How to use it

  1. Paste a JSON document, an array of records or JSON Lines (one sample per line), or open a file.
  2. For an array of records, tick “A top-level array is a list of samples” to describe one record.
  3. Choose the options: a title, required keys, no other keys, formats, examples.
  4. Copy the schema or download it as a .schema.json file, then adjust it to your data.

Rules and limits

How the schema is made

Limits

Questions and answers

Why is a field not in the required list?

Because one of your samples does not have it. Add the field to that sample if it is always there in reality, or edit the list by hand; the page can only go by what it sees.

Why does a field get “number” and not “integer”?

Because a sample writes it with a decimal point or an exponent, such as 2.0 or 1e3. A price written as 10.00 should stay a number; change it to integer by hand if the field only ever holds whole values.

Does a validator check the formats?

Only when you ask it to: in draft 2020-12 “format” is an annotation by default, and many validators check it only with format checking switched on. Because the page adds a format only when all your values match, switching it on will not reject your samples.

Can it describe records of different kinds?

It merges everything into one schema, so a field that is text in one sample and a number in another gets both types. For records of different kinds, make one schema per kind and join them with oneOf by hand.

Related tools