JSON to JSON Schema generator
Paste a JSON sample and get a JSON Schema that describes it: types, nested objects, arrays, required keys and string formats. Turn on strict mode to get a schema you can pass to an LLM API for structured outputs.
Your JSON never leaves the browser — no upload, no server.
Options
Strict mode makes every key required, addsadditionalProperties: false to every object, and turns keys that are missing from some array items into nullable types, so the model sends null for them. It leaves out$schema and only detects the formats Structured Outputs supports.
Could not read the JSON
Check these
JSON Schema
Responses API text.format
About this tool
The generator reads one JSON sample and infers a schema from it. Strings, booleans and null map to their JSON Schema types. Whole numbers become integer, and a property that holds both whole and decimal numbers becomes number.
For an array of objects, every item is merged into one item schema. A key that appears in every item goes in required. A key that appears in some items stays optional, unless you tick "Make every key required". A value that is sometimes null gets a type array like ["string", "null"], and arrays that mix objects, arrays and primitives use anyOf. An array that is always empty gets items: {} and a warning, because one sample can't tell what goes in it.
Format detection adds date-time, date,email, uuid, ipv4 anduri when every string value of a property matches. Draft-07 has no uuid format, so it's skipped there. In draft 2020-12,format is an annotation by default, so a validator only checks it when you turn format validation on. Ajv, for example, gets its formats from the ajv-formats plugin.
Strict mode follows the "Supported schemas" rules in OpenAI's Structured Outputs guide: all fields required, optional fields as a union with null, additionalProperties: falseon every object, an object at the root, up to 5000 properties and 10 levels of nesting. It warns when your sample breaks one of those. You can paste the generated block into text.format in the Responses API. Check your provider's docs for other APIs, because each one supports its own subset of JSON Schema.
A schema inferred from one sample is a starting point. Read it, addenum, minimum or pattern where you know the rules, and test it with theJSON Schema validator.
Read more
Free books, courses, and software
Get my programming books, course editions, and complete software.
Get the download library →