JSON Schema Generator
This JSON Schema Generator turns a sample JSON object or array into a valid JSON Schema
This JSON Schema Generator turns a sample JSON object or array into a valid JSON Schema
How to use JSON Schema Generator
- Paste a sample JSON object or array into the input box.
- Pick a schema draft and toggle required, additionalProperties, and examples options.
- Copy the generated JSON Schema or download it as schema.json.
About JSON Schema Generator
This JSON Schema Generator turns a sample JSON object or array into a valid JSON Schema. Paste an example of your data and it infers a type for every field, walks nested objects and arrays, and merges the shapes of array items so the schema covers all of them. You can choose Draft 2020-12, Draft-07, or Draft-04, add a title, mark present keys as required, set additionalProperties to false, and optionally carry example values through from your sample.
The schema is inferred purely from the example you provide, so it describes the structure you actually have, not rules you might want to add later. It detects string, number, integer, boolean, null, object, and array types. When array elements or repeated objects differ, it unions their types and keeps a key required only when it appears in every sample of that shape. It does not guess formats (email, date, uri), min/max, patterns, or enums, so treat the output as a solid starting point you can tighten by hand.
Everything runs locally in your browser using the built-in JSON parser. Your data is never uploaded, stored, or sent anywhere, which makes it safe to paste real payloads. You can copy the result or download it as schema.json.
Frequently asked questions
- How does it decide which fields are required?
- With the required option on, every key present in the sample is marked required. When you provide an array of objects, a key is kept required only if it appears in all of those objects; keys that appear in some but not others are treated as optional.
- Which JSON Schema drafts are supported?
- You can generate against Draft 2020-12, Draft-07, or Draft-04. The tool sets the matching $schema URI. The inferred keywords (type, properties, items, required, additionalProperties) are compatible across all three.
- Does it detect formats like email, date, or UUID?
- No. It infers structural types only (string, number, integer, boolean, null, object, array). It does not guess semantic formats, patterns, enums, or min/max constraints, so add those manually if you need stricter validation.
- Is my JSON uploaded anywhere?
- No. Parsing and schema generation happen entirely in your browser. Nothing is sent to a server, so you can safely use real or sensitive data.
- What happens with an empty array?
- An empty array produces an array schema with no items constraint, because there is no element to infer a type from. Add at least one representative element to have the item schema generated.
- Can I generate a schema from an array at the top level?
- Yes. If the top-level value is an array, the tool produces an array schema and infers a merged items schema from its elements.