JSON Schema Generator
Draft-07Generate JSON Schema Draft-07 from sample JSON. Free online json schema generator detecting types, arrays, required fields, and formats.
How to generate a JSON Schema from JSON
This tool operates as a versatile json schema generator and generate json schema from sample. Paste a representative sample of your JSON data into the input editor. The more complete your sample (covering all possible fields and value types), the more accurate the generated schema will be. Optionally set a schema title and enable strict mode, then click Generate. The output is a valid JSON Schema Draft-07 document ready to use with any JSON validator.
How are types and formats inferred with GENERATE JSON SCHEMA FROM SAMPLE
The generator inspects each value in your JSON: numbers are distinguished as integer or number, strings are tested against regex patterns for date-time, date, email, uri, and uuid formats. All non-null fields in your sample are marked as required. Nested objects and arrays of objects recurse into child schemas.
Using the generated schema for validation
Copy the generated schema and use it with any Draft-07 compatible validator - ajv in Node.js, jsonschema in Python, Postman's schema validation, or OpenAPI 3.0 component definitions. The schema can also be used in VS Code for JSON IntelliSense when referenced in a $schema property.
Frequently Asked Questions
What is a json schema generator used for?
A json schema generator infers typing and structural constraints from a JSON sample, providing a draft validation file for APIs.
How does this online generator infer types and formats?
The generator inspects each value in your sample JSON. Numbers are categorized as integers or numbers, booleans are mapped directly, and strings are matched against regex patterns to automatically infer formats like date-time, email, uri, and uuid.
What does strict mode (additionalProperties: false) do?
When enabled, the generated schema sets additionalProperties: false on objects. This informs JSON validators that any fields not explicitly declared in the schema's properties list should be rejected as invalid, forcing strict schema conformance.