What the JSON Schema Generator does
JSON Schema Generator reads one sample document and writes a draft-07 schema describing its shape. Object keys become properties, values decide the types, and every key whose value is not null is listed in the root required array. A sample object captured from an API, a config file or a fixture is enough to start a contract for validation, documentation or a tool that expects a schema.
Paste {"name":"John","age":30,"tags":["dev"]} and the output is a schema with type object, a properties entry for each key, age typed as integer, tags as an array whose items are strings, and required holding name, age and tags. The stats line reports how many properties were found and how many required entries were written.
How to use it
- Paste one sample objectThe box is prefilled with a realistic example and a schema is generated on page load, so you see the output shape before pasting your own data. Any valid JSON value works as a source.
- Press Generate SchemaThe sample is parsed and walked recursively. Each value is typed as object, array, string, integer, number, boolean or null, and a draft-07 schema object is printed into the panel below.
- Read the required listTop-level keys that held a non-null value appear in required. A key whose sample value was null still becomes a property, but stays out of required, because the sample says nothing about it.
- Copy the schema outSelect the printed text and copy it into your editor. There is no download button, so keep select-all in mind for schemas longer than the visible area of the panel.
Options and formats
Things to watch out for
Frequently asked questions
Which draft does the output target?
The schema declares draft-07 in its $schema line, the version most validators and code generators accept today. Keywords from newer drafts, such as prefixItems or $defs, are not produced, so a 2020-12-only validator may need small edits.
How are integers and decimals treated?
A whole number such as 30 becomes integer, and a fractional value such as 95.5 becomes number. Both are inferred from the JSON text, so a value written as 30.0 arrives as number rather than being rounded into an integer.
Do false and zero count as required?
Yes. The check is only for null and undefined, so isAdmin false and count 0 are both present values and both land in required. Only an explicit null leaves a key out of that array while it still appears under properties.
Can I merge several samples into one schema?
No. Inference works from the single document in the box. To cover optional fields and variants, generate once per sample and merge the properties and required lists yourself, or paste one document that contains every field you care about.
Does it validate data against the schema?
No. It only writes a schema from an example. Nothing is checked against the result, so a field missing from your sample simply never appears in the output. Use a separate validator when you want to test real payloads.
What about a top-level array or scalar?
A scalar is typed on its own, so pasting 42 returns a schema of type integer, and a top-level array is described from its first element. Neither form produces a required array, and most APIs expect an object at the root anyway.