JSON Schema generator

Paste an example JSON document and get a JSON Schema that describes it. Use it as a starting point for validation, API documentation or code generation, then tighten it by hand.

Indent

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Paste a representative JSON document. The more variety it has, the better the schema.
  2. Choose the indent and the options: required keys, format detection, and whether extra properties are forbidden.
  3. Copy the schema into your validator, OpenAPI file or documentation.

How types are inferred

In the sample In the schema
true, false boolean
3, -7, 1.0 integer
2.5 number
"text" string (plus format when it matches)
null null
[...] array with one merged items schema
{...} object with properties and required

When the same place holds different types in different array items, the type becomes a list in a fixed order, for example ["null", "string"].

Example

[{"a": 1, "b": "x"}, {"a": 2.5}]

gives an array whose items are objects with a of type number (the integer and the decimal merge) and b of type string. Only a is required, because the second object has no b.

Tips

Use several array items when you can, so optional keys and mixed types show up. Turn on Forbid extra properties only when the sample is complete, because it adds "additionalProperties": false to every object. JavaScript reads JSON numbers as doubles, so very large integers in the sample may lose precision before they are classified.

Frequently asked questions

Which JSON Schema version does it produce?

Draft 2020-12. The output starts with "$schema" set to https://json-schema.org/draft/2020-12/schema, and uses type, properties, required, items, format and additionalProperties.

How does it decide which keys are required?

A key is required when it appears in the object. For arrays of objects, the items are merged and a key is required only if every object in the array has it. In the sample, "note" is optional because only one order has it.

Why is a number marked integer or number?

A value without a fractional part, such as 2 or 1.0, becomes integer, and any other number becomes number. If an array mixes both, the merged type is number, which covers integers too.

Which string formats are detected?

date-time (with seconds and a time zone), date, email, uuid, ipv4 and uri (with a scheme such as https://). A format is kept only if every string at that place has the same one. In draft 2020-12, format is an annotation by default, and many validators check it only when you enable it.

What will the schema not tell me?

Only what the sample shows. It does not guess enums, patterns, minimum or maximum values, or lengths, and an empty array gives no items rule. A sample with only one value also cannot show that a field may be null; add such cases by hand or include them in the sample.

More in Developer

All tools in this category: Developer ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.