loot.tools

JSON Schema Generator

Paste a JSON object or array and get a JSON Schema describing its shape. Object keys become properties, keys present in every sample become required, and array items are merged into a single item schema. Pick draft-07 or 2020-12 output.

Paste JSON to generate a JSON Schema. Keys present in every object sample become required, and array items are merged into one schema.

JSON Input
JSON Schema

What this tool does

Paste a JSON sample and get a JSON Schema back. Each object key becomes a property with its inferred type, nested objects and arrays are described recursively, and the array of items is merged so one schema covers every element. The output is a complete schema document with a $schema declaration, ready to drop into a validator.

Why you'd use this

Writing a JSON Schema by hand from an example payload is slow and easy to get wrong. Generate a starting schema from a real response in seconds, then tighten it - add formats, patterns, or bounds - instead of starting from a blank file. It's handy for documenting an API, validating config files, or seeding an OpenAPI definition.

How types and required fields are chosen

Whole numbers map to integer, decimals to number, and the usual string, boolean, and null types are detected directly. When a field shows more than one type across samples, the schema lists them as an array of types. A property is marked required only when it appears in every object sample, so optional keys in a list of records stay optional. Turn off the required toggle if you want a looser schema.