Free JSON Schema Generator
Generate JSON Schema from your JSON data automatically. Free, fast, and works entirely in your browser with no sign-up required.
Updated
JSON Schema Generator
Generate JSON Schema with format detection, constraints, and support for multiple draft versions.
Generation OptionsShow
JSON Input
Generated Schema12 props, depth 2
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"minLength": 1,
"maxLength": 255,
"description": "Id"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"description": "Name"
},
"email": {
"type": "string",
"format": "email",
"minLength": 1,
"maxLength": 255,
"description": "Email"
},
"age": {
"type": "integer",
"minimum": 0,
"maximum": 1000000,
"description": "Age"
},
"isActive": {
"type": "boolean",
"description": "Is active"
},
"website": {
"type": "string",
"format": "uri",
"minLength": 1,
"maxLength": 255,
"description": "Website"
},
"createdAt": {
"type": "string",
"format": "date-time",
"minLength": 1,
"maxLength": 255,
"description": "Created at"
},
"tags": {
"type": "array",
"items": {
"type": "string",
"format": "hostname",
"minLength": 1,
"maxLength": 255,
"description": "Item0"
},
"minItems": 1,
"maxItems": 100,
"uniqueItems": true,
"description": "Tags"
},
"address": {
"type": "object",
"properties": {
"street": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"description": "Street"
},
"city": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"description": "City"
},
"zipCode": {
"type": "string",
"format": "hostname",
"minLength": 1,
"maxLength": 255,
"description": "Zip code"
}
},
"additionalProperties": false,
"required": [
"street",
"city",
"zipCode"
],
"description": "Address"
}
},
"additionalProperties": false,
"required": [
"id",
"name",
"email",
"age",
"isActive",
"website",
"createdAt",
"tags",
"address"
]
}Frequently Asked Questions
What is the JSON Schema Generator?
The JSON Schema Generator is a free online tool that automatically creates JSON Schema definitions from sample JSON data for API validation and documentation.
Is the JSON Schema Generator free?
Yes, it is completely free with no registration required. All schema generation happens client-side in your browser.
Does it store my JSON data?
No, all processing happens locally in your browser. Your JSON data is never sent to any server.
Does the JSON Schema Generator work on mobile devices?
Yes, the JSON Schema Generator is fully responsive and works on smartphones and tablets. You can use it on any device with a modern web browser -- no app download required.
Do I need to create an account to use this tool?
No account or registration is needed. Simply open the JSON Schema Generator in your browser and start using it immediately. There are no sign-up walls or usage restrictions.
What programming languages or formats does this support?
The JSON Schema Generator supports a wide range of popular formats and languages. Check the tool interface for the full list of supported options.
How do I use the JSON Schema Generator?
Simply enter your input in the provided field, adjust any settings to your preference, and the tool will process it instantly. You can then copy the result to your clipboard or download it.
Which browsers are supported?
The JSON Schema Generator works in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera. For the best experience, use the latest version of your preferred browser.
What is the difference between JSON and JSON Schema?
JSON is the data itself — the actual object with real values, like a user record or an API response. JSON Schema is a separate document that describes the shape of that data: which fields exist, what type each one is (string, integer, boolean, array, object), which are required, and what values are allowed. Think of JSON as a filled-in form and JSON Schema as the blank template plus its rules. Validators read the schema to check whether any given JSON payload conforms before your code trusts it, which is how APIs catch malformed requests early. You write JSON by hand constantly, but writing the matching schema is tedious for nested data. This tool flips that around: paste a sample JSON object and it infers a complete schema for you to refine.
Which JSON Schema draft version should I choose?
This generator targets four drafts, and the right one depends on your validator. Draft-07 is the recommended default for new projects — it is the most widely supported across libraries like Ajv, and it is what most tutorials assume. Pick Draft-04 only if you are working with older or legacy tooling that has not been updated. Draft-2019-09 introduced $defs and recursive references, while Draft-2020-12 is the latest and uses updated array keywords and $dynamicRef; choose these when your stack explicitly supports them or when you need their newer features. Changing the version here updates the $schema URL at the top of the output so your validator loads the correct rule set. If you are unsure, start with Draft-07 in the version selector and switch later if a tool complains.
Why does the generated schema include additionalProperties: false?
By default this tool adds additionalProperties: false to every object, which tells a validator to reject any payload containing keys that were not in your sample. It is a deliberately strict starting point: it locks the contract to exactly the fields you provided, so unexpected or misspelled keys fail validation instead of slipping through silently. That is ideal for internal APIs where you want a tight, predictable shape. However, it can be too rigid for public or evolving APIs that may add optional fields over time — in those cases a new field would break clients using the strict schema. The fix is simple: delete that line or set it to true to permit extra properties. Generate your schema here, then relax additionalProperties on the objects where your API genuinely allows extension.
How does the tool decide which fields are required?
The generator lists every non-null key from your sample under the schema's required array, on the assumption that a field present in your example is expected to be present in real data. It also separates integer from number so whole numbers are typed precisely, and with format detection on it tags strings matching known patterns like email, uri, date-time, uuid, ipv4, and ipv6. The important caveat is that required fields reflect a single sample. If a key happens to be absent or null in one payload but optional in practice, the tool cannot know that from one example — so review the required list and remove any fields that are genuinely optional before shipping. Treat the output as a strong first draft. Paste your most complete representative sample to get the most accurate required-field inference from this tool.
Are the minLength and minimum constraints in the schema safe to use as-is?
Not without review. When you enable constraints, the tool seeds bounds inferred from your sample — minLength and maxLength for strings, minimum and maximum for numbers, and minItems, maxItems, and uniqueItems for arrays where the sample elements are all distinct. These are computed from one example, so they describe what your sample happened to contain, not the true business rules. For instance, if your sample username was eight characters, the maxLength might be set to eight even though longer names are valid, which would wrongly reject real data. Treat every generated constraint as a sensible default to tighten or loosen, never as a final rule. The stats badge showing property count and nesting depth helps you confirm the structure matches expectations. Generate the schema here, then adjust the bounds against your real data ranges before deploying it.
Related Tools
Free JSON to Type Generator
Convert JSON to TypeScript interfaces, Go structs, or Rust types. Free, fast, and works entirely in your browser with no sign-up required.
Protobuf to JSON Schema
Convert proto3 definitions to JSON Schema, TypeScript interfaces, and sample JSON. Supports messages, enums, nested types, oneof, map, repeated.
Free OpenAPI Viewer & Swagger Spec Explorer
Free OpenAPI viewer and Swagger viewer. Paste an OpenAPI or Swagger spec to browse endpoints, inspect schemas, and generate cURL commands. Runs entirely in your browser — no upload, no sign-up.
Free API Tester Online
Test REST APIs with GET, POST, PUT, DELETE requests. Free, fast, and works entirely in your browser with no sign-up required.
About the JSON Schema Generator
The JSON Schema Generator turns a sample of JSON data into a complete JSON Schema definition. Paste a real API response, a config file, or any JSON object, and the tool infers the types, structure, and constraints for you — then prints a ready-to-use schema you can copy or download. It is built for backend and API developers, integration engineers, and anyone who needs a contract for their data but does not want to hand-write nested schema by hand.
JSON Schema is the standard vocabulary for describing the shape of JSON: which fields exist, what type each one is, which are required, and what values are allowed. Writing it manually is tedious and error-prone for anything beyond a flat object. This generator does the first 90 percent automatically so you can refine the last 10 percent.
Everything runs in your browser. The JSON you paste is parsed and analyzed on your own device — it is never uploaded to a server. That means you can safely drop in a production payload, an internal API sample, or a config with placeholder secrets without it leaving your machine. There is no sign-up, no rate limit, and nothing to install.
What it generates from your JSON
The generator walks your data recursively and builds a typed schema that mirrors its structure:
- Type inference — distinguishes
string,boolean,null,array, andobject, and separatesintegerfromnumberso whole numbers are typed precisely. - Nested objects and arrays — descends into every level, producing a
propertiesblock for each object and anitemsschema for arrays based on the elements found. - Required fields — lists non-null keys under
required, since their presence in your sample implies they are expected. - Title and description — add an optional schema title and description, or let the tool generate per-property descriptions from field names (so
createdAtbecomes "Created at").
By default it also sets additionalProperties: false, locking the schema to exactly the keys in your sample — a strict starting point you can relax if your API allows extra fields.
Format detection and constraints
Beyond raw types, the generator recognizes common string formats and adds validation hints. Toggle format detection on and it tags strings that match well-known patterns: email, uri, date-time, date, time, uuid, ipv4, ipv6, and hostname. So a value like john@example.com is typed as a string with "format": "email", and a UUID is recognized automatically.
Enable constraints and the tool seeds bounds you can tighten later: minLength/maxLength for strings, minimum/maximum for numbers, and minItems/maxItems plus uniqueItems for arrays when the sample items are all distinct. These are inferred from your example, so treat them as sensible defaults rather than final rules.
Choosing a draft version
JSON Schema has evolved through several specification drafts, and validators support different ones. The generator lets you target four:
- Draft-04 — the oldest, still widely embedded in legacy tooling.
- Draft-07 — the most commonly used and the recommended default for new projects.
- Draft-2019-09 — introduced
$defsand recursive references. - Draft-2020-12 — the latest, with
$dynamicRefand updated array keywords.
Switching the version updates the $schema URL at the top of the output so your validator loads the correct rules. A live stats badge shows the total property count and nesting depth, an at-a-glance check that a large payload generated the structure you expected.
A generated schema is a strong draft, not gospel: types and required fields reflect one sample, so review optionality and tighten constraints against your real data before shipping it as an API contract. Use the built-in Format button to clean up messy input, then copy or download the result as a .json file ready to drop into your validation layer or OpenAPI definition.