📐JSON Schema Generator

Draft a schema from a JSON sample

You Might Also Need

About This Tool

Paste a JSON sample such as an API response or a config file and get a JSON Schema draft 2020-12 starting point that matches its shape. You can choose whether to emit the $schema line and a title, how to handle required, whether to pin additionalProperties, and the indentation. Syntax errors are reported with the line and column of the problem.

The structure, the key names and the type each value actually has in the sample are stated as fact. Integers and decimals are split into integer and number based on whether the literal has a decimal point or exponent, and arrays of objects get a merged property set where only keys present in every item are marked required. Below the output, the tool separates what is certain from what was inferred. Uses JSON Schema draft 2020-12 notation as of October 2026.

One sample cannot settle required, enum, minimum and maximum, length limits or pattern. This tool does not invent those constraints, and every inference it does make is tagged. Empty arrays get a blank item schema and arrays with mixed types get a list of types. Treat the result as a draft and validate it against several real responses before relying on it.

Frequently Asked Questions

Why is required labeled as inferred?

A key appearing in the sample means it can appear, not that it always does. You may have captured one response where an optional field happened to be filled, so confirm the real requirements against the API docs or several responses.

What happens when objects inside an array have different keys?

All keys are merged into properties, and only the keys present in every single item are listed as required. The tool flags that this happened with an inference tag.

What does this tool not do?

It does not validate data against a schema, and it does not generate sample data from a schema. It also never guesses constraints such as enum values or numeric ranges.