API Toolkit

JSON Schema Generator

All tools

Start a schema from real data instead of a blank file.

How it works

Four simple steps

1

Paste a sample

Use a complete, valid example document.

2

Schema is inferred

Types, properties, items and required keys are filled in.

3

Relax the rules

Trim required lists and widen types that can vary.

4

Save schema.json

Copy the schema or download the file.

JSON Schema Generator

About JSON Schema Generator

Your team wants to validate incoming config files in CI, and nobody has written a schema yet. The quickest start is to take a known-good file, generate a schema from it, and then loosen the parts that are allowed to vary.

Paste a JSON document and the generator returns a schema that declares the 2020-12 draft in $schema and carries the title GeneratedSchema. Objects get a properties map and a required list containing every key that appeared. Whole numbers are typed integer and others number, strings, booleans and null get their own types, and arrays describe their items using the first element. An empty array produces an items schema of {}, which accepts anything. Output updates as you type, and Download saves it as schema.json.

A schema inferred from one example is strict in some places and loose in others. Every key is required, even ones your system treats as optional, and an array whose first item differs from the rest takes the first item's shape. There are no formats, patterns, enums or length limits. Edit the required arrays, add additionalProperties: false if unknown keys should fail, and widen a "null" type to a list such as string and null where a value can be either. Make sure the sample parses with the online JSON checker, then feed the schema to the Zod and TypeBox code generator for runtime checks in TypeScript.

Inference happens in your browser, so the sample can come from production data without being uploaded.

Keyboard shortcut

Ctrl Enter - Run tool
FAQ

Frequently asked questions

See all FAQs

Answers for this tool. For site-wide help, open the FAQ hub.

Draft 2020-12, declared in the $schema keyword. If your validator expects draft-07, change the $schema URL; the keywords this tool generates mean the same thing in both drafts.

The generator only sees one document, so it assumes every key in it is always present. Remove keys that can be missing from the required arrays.

No. Paste one representative document. Merging the differences between samples, such as fields that only some records have, is a manual edit afterwards.

View more FAQs

Related tools

View all

Webhook HMAC Signer

Sign and verify GitHub, Stripe, and Slack webhook signatures locally.

Open

Webhook Replay Diff Lab

Compare webhook payload timelines, re-check HMAC digests, and spot idempotency gaps locally.

Open

JSONPath Playground

Query JSON with JSONPath and JMESPath-style paths side by side.

Open

GraphQL Studio

Format, validate, and cost-estimate GraphQL documents with cURL export.

Open

Explore 321 free tools

Everything you need as a developer, marketer or creator - in one beautiful place.

Browse all tools