JSON Schema Generator
Infer an editable JSON Schema draft-07 from a JSON sample. Merge all array samples, review optional fields and mixed types, then copy or download the draft.
Local inference only. Up to 200,000 characters, 20,000 visited sample values and 40 nesting levels. No upload or automatic saving.
Review the draft before use. Manual edits are exported as written and are not validated here.
What is JSON Schema Generator
Generate a starting schema from observed JSON structure, rather than validating data against an existing schema. The result uses draft-07, merges every array item and keeps mixed types as anyOf branches. Samples cannot establish business rules, so review the output before using it as a contract.
How to use JSON Schema Generator
- Paste a JSON value or load the example. An array remains an array in the generated schema.
- Optionally mark properties found in every sampled object as required. This is an observation, not proof that a field is mandatory.
- Generate, edit the draft if needed, and copy or download. Validate your edited schema separately.
Features and limits
- All JSON numbers are described as number; the tool does not guess integer constraints, ranges, formats, enum values or closed objects.
- Object properties are merged across array samples. Empty arrays use an unconstrained items schema. Additional properties remain allowed.
- Input is parsed with JSON.parse. Duplicate keys follow its last-value behavior. No sample values or numeric limits are emitted, so numeric spelling is not preserved in the schema.
This tool processes your input in this browser and does not upload it for processing.
Input: [{"id":1},{"id":2,"label":"x"}]
With required enabled: array items have id (number) and label (string); only id is required.Frequently asked questions
Does one sample define a complete schema?
No. The output describes observed types. Missing cases, allowed values and business constraints require manual review.
How are null and empty arrays handled?
Null is its own type. Mixed null and non-null samples produce anyOf branches. Empty arrays provide no evidence about item types, so items remains unconstrained.
Can the existing validator use this output?
The generated draft uses JSON Schema draft-07. Copy it into the validator with representative data. Manual edits are not validated by this generator.