Your files stay on your device

Generate a JSON schema from JSON

Paste an example of your JSON and get a JSON Schema that describes it. The schema is checked against your example before you see it.

Example JSON

Paste, type, or drop a file

Schema

Loading editor…

How samples decide required fields

A generator only knows the examples it receives. With one sample, every member present is marked required. With several, the tool counts how many samples contain each member. Set the threshold to 100 percent and a member is required only when every sample has it. Lower the threshold to half, and a member present in half the samples qualifies.

Nullable fields in the type list

JSON Schema drafts 2020-12, 2019-09, and draft-07 express a nullable value with a type list. "type": ["string", "null"] accepts a string or JSON null. A plain "type": "string" rejects null, so a field that is sometimes null needs the list form.

Format checks are optional

In 2020-12, validators treat format as an annotation unless they are told to assert it, so a malformed date-time can still pass.

Two keywords to recognize in a generated file:

"format": "date-time"Declares a timestamp-shaped string
"required": ["id"]Fails any object that has no id member

Was this tool useful?