About this tool
Writing a JSON Schema by hand means typing every property name twice and guessing which fields are required. This generator does the boring part: paste a representative JSON example and it emits a complete draft-07 schema. Types are inferred for every node — strings, integers versus floats, booleans, nulls, nested objects and arrays — and arrays of objects are merged so that properties present in every element become required while optional ones stay optional, exactly the semantics you want for validating real API payloads. String values that consistently look like emails, URLs, UUIDs, dates or date-times get the matching format keyword, and properties whose observed values fit a small domain (six distinct values or fewer) are captured as an enum, which is perfect for status and role fields. Mixed-type fields become anyOf unions. Review the generated schema, tighten anything inference cannot know — a minimum, a maxLength, a stricter pattern — then copy it or download it as a .schema.json file ready for Ajv, Python's jsonschema, or your IDE. Generation runs entirely in your browser, so private payloads stay private.
How to use JSON Schema Generator
- Paste a representative JSON example into the input area, or press Load sample.
- Press Generate schema to infer a draft-07 schema from the example.
- Review the inferred types, required fields, enums and formats, and tighten constraints the sample cannot express.
- Copy the schema or download it as a .schema.json file, then use it with a validator such as Ajv or Python's jsonschema.
Frequently asked questions
Which schema draft is generated?
JSON Schema draft-07, declared via the $schema keyword. Draft-07 is the most widely supported version across validators, IDEs and API tooling.
How are required fields and enums decided?
For an array of objects, a property is marked required when it appears in every element. An enum is emitted when a string or integer property has six or fewer distinct observed values, which typically means a closed set such as a status or role field.
What formats are detected in strings?
Email addresses, URLs, UUIDs, ISO dates and date-times are recognised and annotated with the corresponding format keyword. Formats are hints for validators — many only enforce them when format assertion is enabled.
Is my example data uploaded?
No. The schema is generated by JavaScript running locally in your browser. Nothing is transmitted or stored.