JSON to JSON Schema
Runs entirely in your browser — your JSON is never uploaded to a server. No ads injected into the output, no sign-up. Emits draft-07 with required and additionalProperties set, so it drops straight into Ajv or python-jsonschema.
How to generate a JSON Schema from a JSON sample
- Paste your JSON. Paste one representative JSON object (or array) into the box above.
- Generate the schema. Click Generate JSON Schema. The tool infers a type for every field and emits a draft-07 schema with required and additionalProperties set.
- Validate payloads. Load the schema into a validator such as Ajv (JavaScript) or jsonschema (Python) to validate real payloads against it.
How the inference works
Each JSON value maps to a JSON Schema type: a whole number becomes "integer", a decimal becomes "number", a string becomes "string", true/false becomes "boolean", and null becomes "null". Objects become {"type":"object"} with a properties map, and every key present in the sample is listed under required. Arrays become {"type":"array"} and the schema of the first element is used for items. Every object also gets "additionalProperties": false so the schema rejects unknown keys by default — delete that line if you want an open schema. The output declares draft-07 via $schema, which is the most widely supported dialect in validators like Ajv.
FAQ
Which JSON Schema dialect is generated?
Draft-07 — it is declared in the $schema line and is supported by Ajv, python-jsonschema and most other validators. You can change the $schema URL to target a newer draft; the keywords used here (type, properties, required, items, additionalProperties) are valid across all modern drafts.
Why are all fields marked required?
A single sample cannot tell which keys are optional, so every key present is listed as required. Remove any field from the required array to make it optional.
Why additionalProperties: false?
It makes the schema strict — any key not in the sample is rejected. If your real payloads carry extra keys, delete the additionalProperties line from that object or set it to true.
Does my JSON leave the browser?
No. The schema is generated entirely in your browser with JavaScript; nothing is uploaded to a server.