JSON Schema Generator
Generate JSON Schema from any JSON. Perfect for API validation and documentation.
Why use it
APIs documented and validated automatically
Draft 2020-12
Generates schemas compatible with the latest IETF standard and OpenAPI 3.1.
Private
JSON is processed in your browser. Never sent to any server.
Inferred types
Detects strings, numbers, booleans, arrays, and nested objects automatically.
Instant
Schema generated in milliseconds. No signup, no waiting.
How it works
Three steps, no hassle
Paste your JSON
Paste any valid JSON object. The generator analyzes the structure and types of each field.
Review the generated schema
The JSON Schema appears with inferred types, required properties, and optional descriptions.
Copy or download the schema
Use the schema in your API, validator (ajv, zod), or OpenAPI documentation. Copy with one click.
FAQ
Got questions?
JSON Schema is a vocabulary that allows annotating and validating JSON documents, defined as an IETF draft. It describes the expected structure of a JSON document: what properties it should have, their types (string, number, array, object), which are required, valid value ranges, regex patterns for strings, and more. It is the de facto standard for documenting and validating REST APIs, data contracts, and application configurations.
The latest version is JSON Schema draft 2020-12, published in December 2020. It introduces improvements to $ref (now combinable with other keywords), prefixItems for tuple arrays, and the unevaluatedProperties vocabulary. For compatibility with older tools, draft-07 remains widely used. OpenAPI 3.1 adopts JSON Schema draft 2020-12 as a subset, so if you use OpenAPI 3.1 you should use 2020-12.
In JSON Schema, the 'required' keyword is an array of strings with property names that must be present in the object. A property defined in 'properties' but not listed in 'required' is implicitly optional: it can be present or absent without failing validation. The distinction is critical for APIs: a missing required field in a request should return a 400 error, while an absent optional field simply uses the default value.
For arrays of objects, use 'type': 'array' with 'items' pointing to the schema of the contained object. For example: { 'type': 'array', 'items': { 'type': 'object', 'properties': { ... } } }. You can also define 'minItems' and 'maxItems' to control array length, and 'uniqueItems': true to require no duplicates. For fixed-length arrays with heterogeneous types, use 'prefixItems' (draft 2020-12) or 'items' as an array (draft-07).
$ref is a JSON Schema keyword that references another schema by URI, enabling reusable definitions. It is used with $defs (draft 2020-12) or definitions (draft-07) to avoid repeating the same structure. For example, an 'Address' schema defined once can be referenced from both 'billingAddress' and 'shippingAddress'. This reduces redundancy, simplifies maintenance, and is essential for OpenAPI schemas with shared models across multiple endpoints.
JSON Schema history and the validation ecosystem
JSON Schema was proposed by Kris Zyp in 2009 as an informal specification published on the SitePen blog. The first formal version as an IETF draft was draft-00 in 2010. Since then there have been multiple revisions (draft-01 through draft-07, then 2019-09 and 2020-12) without becoming an official RFC, though it is widely adopted as the de facto standard. The IETF standardization process requires reference implementations and interoperability tests, which the JSON Schema community is actively completing.
JSON Schema integration with OpenAPI is fundamental in modern API development. OpenAPI 2.0 (Swagger) used a limited subset of JSON Schema draft-04. OpenAPI 3.0 improved compatibility but maintained its own extensions like 'nullable'. OpenAPI 3.1 adopted full JSON Schema draft 2020-12, eliminating discrepancies. Key validation libraries include ajv (Another JSON Schema Validator, JavaScript, with draft 2020-12 support), jsonschema (Python), json-schema-validator (Java), and NJsonSchema (.NET).
Zod, TypeBox, and Yup represent an evolution where schema and validation are defined in TypeScript with automatic type inference, generating JSON Schema as output (not as input). This 'schema-first with type inference' pattern is displacing direct JSON Schema usage in modern TypeScript projects, though JSON Schema remains indispensable for cross-language validation, API contracts between teams with different tech stacks, and event documentation in event-driven architectures (AsyncAPI).