JSON Schema Generator
Infer JSON Schema from a JSON sample.
This runs in your browser. Nothing is uploaded.
Drop a file here or choose oneChoose file
Generate a schema from a sample
JSON Schema Generator parses a JSON sample and describes the fields, value types, and nested structures it can see. Use the Sample action, paste a representative response, or drop a.json file into the input.
The output is pretty-printed JSON Schema draft-07. Copy it into a project, downloadschema.json, or edit it to match the contract your application actually exposes.
A sample is not an API contract
Inference is not validation. The generated schema describes the values in the supplied sample, but it does not prove that future responses contain the same fields, types, or constraints. It does not guess formats such as dates, identifiers, or currency.
Add descriptions, formats, limits, patterns, and domain-specific rules during review. If you need to inspect or repair the source JSON first, use JSON Formatter.
Objects, arrays, null, and optional keys
Object properties are kept in first-seen order. Keys present in every object in an array are required, while keys missing from one or more objects remain optional. Arrays of primitive values use a stable type union when needed.
Null is represented as a JSON Schema type and can be combined with another type. Empty arrays keep an open items schema, and mixed non-mergeable values use oneOffor manual review.
Review and edit the result
Treat the generated document as a starting point. Check required fields, optional fields, and array shapes against more than one representative response before publishing it. JSON Schema Generator processes input in this browser, and TheDevTab never receives the JSON.
For generated TypeScript declarations, compare the result with JSON to TypeScript. Both tools are inference aids rather than runtime validators.
FAQ
Does JSON Schema Generator upload my JSON?
No. JSON is parsed and the schema is inferred in your browser. TheDevTab never receives the JSON.
What makes a representative JSON sample?
Use an object or array that includes the fields and shapes you expect in real data. More than one representative object in an array helps the generator identify optional keys.
Is the generated schema an API contract or validator?
No. The output describes the sample you supplied. It is not a complete API contract and the generator does not validate future responses or add business constraints.
How are arrays handled?
Array items are inferred together. Arrays of objects merge their keys, missing keys become optional, primitive differences become a type union, and mixed non-mergeable values use oneOf.
How are null values and optional keys represented?
Null is emitted as the null type and can be combined with another primitive type. A key missing from at least one object in an array is omitted from required, so it remains optional.
Can I edit, copy, or download the schema?
Yes. Copy the pretty-printed draft-07 JSON Schema or download schema.json, then edit titles, descriptions, formats, limits, and other rules for your application.