Skip to main content
DevConverter
Home/Format Conversion/JSON Schema Generator

JSON Schema Generator

Generate a JSON Schema (Draft 7) from any sample JSON. Infers types, formats (email, date, URI), and required fields automatically.

About this tool

JSON Schema is a vocabulary that allows you to describe and validate the structure of JSON documents. A schema is itself a JSON document that specifies types, required fields, value constraints, and structural rules. It serves as both machine-readable documentation and a validation contract between services. The current widely-used version is Draft 7, with Drafts 2019-09 and 2020-12 available in newer tooling.

A schema can specify the type of a value (string, number, integer, boolean, array, object, null), numeric constraints (minimum, maximum, multipleOf), string constraints (minLength, maxLength, pattern for regex validation), array constraints (minItems, maxItems, uniqueItems, items schema), and object constraints (required properties, properties schemas, additionalProperties, minProperties). Schema composition keywords allOf, anyOf, oneOf, and not allow expressing complex conditional validation.

JSON Schema is used for: validating API request and response bodies, configuration file validation, code generation (generating TypeScript types or Go structs from a schema), API documentation (OpenAPI specifications use JSON Schema for request/response definitions), and as a contract for service interfaces. Popular validators include ajv (JavaScript, the most widely used), jsonschema (Python), and go-jsonschema (Go). Inferring a schema from sample data, as this tool does, is a useful starting point, but production schemas typically require manual refinement to express the full range of valid inputs.