JSON Schema Generator
Generate a draft-07 schema with required fields inferred from samples.
Runs in your browser. Nothing is uploaded.
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, download schema.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 oneOf for 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 the schema generator send my sample to an API?
The sample is parsed and turned into a JSON Schema in your browser, without a conversion request. The JSON is never uploaded, and TheDevTab never receives it.
What makes a representative JSON sample?
Use an object or array that includes the fields, scalar types, nulls, and nested shapes you expect in real data. Multiple objects in an array help the generator see which keys are present in every object and which are optional.
Is the generated schema an API contract or validator?
No. The output describes only the JSON sample you supplied and is not a complete API contract. The generator does not validate future responses or add business constraints.
How are arrays handled?
Array items are inferred together, and arrays of objects merge their keys across all items. Missing keys stay out of required, primitive differences become a type array, and mixed non-mergeable shapes use oneOf.
How are null values and optional keys represented?
Null is emitted as the null type and combines with another primitive type when both occur in the sample. A key missing from at least one object in an array is omitted from required, so it remains optional.
What does the additionalProperties option do?
When the option is enabled, each inferred object schema includes additionalProperties: false. It does not discover unknown fields, so edit the draft-07 output if the real contract permits properties beyond the sample.