JSON Schema Generator — Draft 2020-12

Private
Output
Examples:

Last updated: 2026-09-17

Paste a JSON object and get a JSON Schema (draft 2020-12) that validates it. The converter infers object types, string/number/integer/boolean/null, array item schemas, and required fields. Toggle additionalProperties to control whether extra keys are allowed. All processing is local.

Integer vs number

The converter distinguishes integers from floating-point numbers. A value of 42 produces {“type”: “integer”}, while 42.5 produces {“type”: “number”}. If a field might contain both, manually change the type to number after generation.

String formats

The converter does not infer string formats (date-time, email, uri, etc.). If your strings follow a known format, manually add the “format” keyword to the schema after generation for better validation.

Multiple samples

The schema is inferred from a single JSON sample. Fields that are optional in your data model but present in the sample will be marked as required. Review and adjust the required array after generation.

Frequently asked questions

What is JSON Schema draft 2020-12?
Draft 2020-12 is the latest JSON Schema specification. It introduced the $dynamicRef keyword, restructured the core vocabulary, and simplified the $ref behavior. The schema generated by this tool uses draft 2020-12 conventions, though it does not add the $schema keyword automatically.
How are required fields determined?
When "Mark non-null fields as required" is enabled, every field that has a non-null value in the input JSON is added to the required array. Fields with null values are not required. Disable this option to generate a schema with no required constraint.
What does additionalProperties do?
When set to false (default), the schema rejects objects with keys not listed in the properties. When set to true, extra keys are allowed. Most strict APIs set additionalProperties to false for input validation.
How are arrays handled?
The converter inspects array elements and generates an items schema. If all elements have the same type, a single items schema is used. If elements have different types, a oneOf array is generated. Empty arrays produce items: {} (any type).
Can I use this schema for runtime validation?
Yes. The output is a valid JSON Schema that can be used with any validator: ajv (JavaScript), jsonschema (Python), or online validators. Add the $schema keyword pointing to https://json-schema.org/draft/2020-12/schema for explicit draft declaration.

Related converters