JSON Schema Generator
Generate a draft 2020-12 JSON Schema from a sample document, with types, nested properties, required keys and nullable fields.
Free · No sign-up · Your inputs stay in your browser
Input
Generate a JSON Schema from a sample
Output
JSON Schema (2020-12)
1,325 characters
A starting point, not a contract: one sample cannot tell a schema about formats, enums or ranges. Add format: email, minimum and enum by hand where the data has rules.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
From sample to contract
A generated schema describes the data you had, not the data that is allowed. Tighten it before relying on it: add format for emails, dates and URIs, minimum and maximum for numbers, enum for fixed sets, and decide whether additionalProperties should be false. The vocabulary is defined at json-schema.org.
Where schemas are used
OpenAPI 3.1 describes request and response bodies with the same 2020-12 dialect, so a schema written here drops into an API description. Validators exist for every language: Ajv in JavaScript, opis/json-schema in PHP, jsonschema in Python.