Web Analytics
Skip to content
← All tools

JSON Schema Generator

Paste a JSON sample and get a JSON Schema (draft 2020-12) inferred from its shape.

Runs 100% in your browser — nothing is uploaded.

About generating a JSON Schema

A JSON Schema describes the shape your JSON is allowed to take: which fields exist, what type each one is, and which are required. Writing one from scratch is slow, so this tool works backwards. Paste a real JSON sample, and it infers a schema from the structure it sees, in your browser. It is the fastest way to get a first draft you can then refine.

The output targets the draft 2020-12 version of JSON Schema, the current standard, and includes the $schema line so validators know which rules to apply.

How the inference works

The tool walks your JSON and maps each value to a type. An object becomes "type": "object" with a properties block and a required list naming every key it found. An array becomes "type": "array" and takes its items type from the first element. Numbers are split into integer or number depending on whether they have a decimal part. Strings, booleans, and null map to their obvious types.

Read the draft, then tighten it

Because the schema comes from a single example, treat it as a starting point, not a finished contract. A sample can only show what was present, so the tool marks every field it saw as required. In your real schema, some of those are probably optional, and you will want to remove them from the required list.

Inference also cannot guess your intent. If an array is empty in the sample, the tool cannot know what belongs inside it. If a string is really an email or a date, the schema just says "string" until you add a format. And if different array elements have different shapes, only the first one is captured. Use the generated schema to skip the boilerplate, then add the constraints, formats, and enums that make it actually validate your data.