JSON to Schema
Convert JSON objects or arrays into JSON Schema (Draft 4, 6, 7, 2019-09, 2020-12) with accurate types, format detection, required fields, and validation rules — all in your browser.
Read the full guide1{2"$schema": "http://json-schema.org/draft-07/schema#",3"type": "object",4"properties": {5"user": {6"type": "object",7"properties": {8"id": {9"type": "integer",10"examples": [11112],13"description": "Id field."14},15"name": {16"type": "string",17"examples": [18"John"19],20"description": "Name field."21},22"email": {23"type": "string",24"format": "email",25"examples": [26"[email protected]"27],28"description": "Email field."29},30"isActive": {31"type": "boolean",32"examples": [33true34],35"description": "IsActive field."36},37"roles": {38"type": "array",39"items": {40"anyOf": [41{42"type": "string",43"examples": [44"admin"45]46},47{48"type": "string",49"examples": [50"editor"51]52}53]54},55"examples": [56[57"admin",58"editor"59]60],61"description": "Roles field."62},63"profile": {64"type": "object",65"properties": {66"age": {67"type": "integer",68"examples": [693070],71"description": "Age field."72},73"address": {74"type": "object",75"properties": {76"city": {77"type": "string",78"examples": [79"New York"80],81"description": "City field."82},83"zip": {84"type": "string",85"examples": [86"10001"87],88"description": "Zip field."89}90},91"required": [92"city",93"zip"94],95"description": "Address field."96}97},98"required": [99"age",100"address"101],102"description": "Profile field."103},104"lastLogin": {105"type": "string",106"format": "date-time",107"examples": [108"2024-03-18T10:24:00Z"109],110"description": "LastLogin field."111},112"homepage": {113"type": "string",114"format": "uri",115"examples": [116"https://example.com"117],118"description": "Homepage field."119}120},121"required": [122"id",123"name",124"email",125"isActive",126"roles",127"profile",128"lastLogin",129"homepage"130],131"description": "User field."132}133},134"required": [135"user"136]137}
JSON to Schema converts API responses, exported records, and pasted JSON into a fully formed JSON Schema document. Pick any draft from Draft 4 through 2020-12, choose a type-mapping strategy, and receive a schema that drops directly into AJV, react-jsonschema-form, OpenAPI 3.1, AWS API Gateway, or any tooling that speaks JSON Schema.
Hand-writing JSON Schema is tedious and error-prone. A missing field in required, a wrong format, or a forgotten $schema URL silently breaks runtime validation. This tool reads the actual JSON shape, infers types and formats, and emits a schema you can commit straight into your repo.
.json file..json.Input JSON card hosts three input tabs: Paste content for direct text, Extract from URL for public JSON endpoints (server-proxied to bypass CORS), and Upload JSON for local .json/.txt files up to 5 MB.
Output JSON Schema renders the result in a compact line-numbered viewer (Raw Schema) and a hierarchy view (Tree View), with Copy and Download .json actions.
Schema Options control the draft URL, root type, type mapping strategy, included metadata (description / examples / required), and additional behaviors (const literals, null types, property order).
Advanced exposes schema title and indent size for the generated JSON.
additionalProperties: false; Loose for permissive consumers.additionalProperties: false for tests that catch unexpected API changes.Pasted JSON and uploaded files are converted entirely in your browser. The Extract from URL tab is the only path that touches the server, and only to proxy the URL you supply so CORS does not block direct fetches. Nothing is stored.
Draft 7 is the most widely supported across tooling (AJV, react-jsonschema-form, OpenAPI 3.1). Draft 2020-12 is the latest spec. Draft 4 is required by older AWS/GCP services. Draft 6 sits between Draft 4 and Draft 7 in compatibility.
Smart detects integers vs numbers, recognizes formats like email/uri/uuid/date-time, and uses examples. Strict emits a single 'number' type and drops format detection. Loose adds 'null' to types when values may be null and is permissive about unknown shapes.
Infer required is on by default. Every key present in the JSON sample becomes required. Turn it off when the upstream API may omit fields and you want a permissive schema.
When a property has a single literal value in the sample (e.g. status: 'active'), the schema emits { const: 'active' } instead of { type: 'string' }. Useful for constant tags and version markers.
When a property is null in the sample, the schema uses { type: ['string', 'null'] } (or appropriate base) so validators accept both null and the inferred type.