JSON Schema Generator
Generate JSON Schema Draft-07 from any JSON object. Infers types, formats, nested objects, and arrays automatically. Free online tool.
Generate a valid JSON Schema from any JSON object in seconds. The tool infers types from values,
detects common string formats (date-time,
email,
uri,
uuid),
and recursively generates schemas for nested objects and arrays. Output conforms to
JSON Schema Draft-07 and is ready to use with AJV, Joi, Zod, or any other validator.
Related tools
Frequently asked questions
What is JSON Schema?
JSON Schema is a vocabulary for describing and validating JSON data structures. A schema describes what fields exist, what types they must be, and what constraints apply (minimum length, pattern, format, etc.). It's used for API documentation (OpenAPI), data validation, code generation, and editor tooling.
Which draft of JSON Schema is generated?
The generator outputs JSON Schema Draft-07 — the most widely supported draft. It's compatible with AJV, Ajv (Node.js), Python's jsonschema library, .NET's Newtonsoft.Json.Schema, and most OpenAPI 3.0 validators. Newer drafts (2019-09, 2020-12) are backwards compatible in practice for the features this tool generates.
Which string formats are detected?
The tool detects: date-time (ISO 8601 timestamps),
date (YYYY-MM-DD),
email,
uri (http/https URLs), and
uuid.
Detection is based on the actual value of the sample JSON — it won't detect a format
if the sample string doesn't match the pattern.
What does "All required" do?
When enabled, every property in each generated object schema is added to the
required array.
This means a validator will reject objects that are missing any of those keys. Disable it
if you want an open schema that accepts partial objects (useful for PATCH requests or
optional API response fields).
How are arrays handled in the generated schema?
If an array contains objects, all objects are merged to capture all possible keys, and
a single items schema
is generated for the element type. If an array contains primitives (all strings, all
numbers, etc.), the items schema uses that primitive type. Empty arrays produce
items: {"{}"}.
How do I use the generated schema with AJV in Node.js?
Install AJV (npm install ajv),
then: const ajv = new Ajv(); const validate = ajv.compile(schema); const valid = validate(data);.
If valid is false,
validate.errors contains the validation errors.