JSON to JSON Schema Generator
Create a reviewable first draft of a JSON Schema from example data. Select the dialect your validator expects and inspect required fields, formats, nulls and literals before treating it as a contract.
Read the full guideDirect answer
JSON Schema describes and validates the expected shape of JSON. A generator can infer types and observed formats from samples, but unobserved optional fields, unions and constraints must be added by a human.
Select the target dialect, generate the draft and validate it with the same engine used in production.
Input JSON
Output JSON Schema
1{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}
How to use it
- Paste/upload JSON or fetch a supported public sample.
- Choose the JSON Schema draft and configure type mapping, descriptions, examples, required inference, const and null behavior.
- Inspect raw/tree output, validate it with the target validator and copy/download the schema.
Key features and settings
- Draft selection from legacy drafts through 2020-12 in the current UI.
- Smart/strict/loose type-mapping controls.
- Descriptions, examples, required inference, const and null options.
- Raw schema and tree views for review.
Supported input and output
Input: JSON text or file, a supported public URL. Output: JSON Schema text or file.
Use cases
- Bootstrap API response/request validation.
- Document fixtures and exported record shapes.
- Create a starting schema for UI generation or contract tests.
Which workflow should you choose?
Use JSON to JSON Schema Generator for: Draft selection from legacy drafts through 2020-12 in the current UI. Use JSON to Function Calling Schema Generator for: Targets currently shown: OpenAI, Claude and Gemini.
Privacy and data path
In the current implementation, pasted/uploaded content is processed in the browser, while “Extract from URL” uses a server-side proxy to fetch the source.
Limits and troubleshooting
- OpenAPI 3.1 aligns with JSON Schema Draft 2020-12 semantics; match the exact dialect supported by the downstream toolchain.
- A single sample makes every present property look required unless the setting is changed; use representative samples and contract knowledge.
- The current UI displays a 5 MB input limit.
FAQ
Which JSON Schema draft should I choose?
Choose the dialect required by the actual validator or platform. Draft 2020-12 is the latest published JSON Schema version, but legacy systems may require an older draft.
Is my data uploaded to a server?
In the current implementation, pasted/uploaded content is processed in the browser, while “Extract from URL” uses a server-side proxy to fetch the source.
What are the file or data limits?
The current UI displays a 5 MB input limit.
Does it work on mobile?
The page is web-based and may work in a modern mobile browser, but file-picker behavior, memory and cross-device compatibility are not verified for every device. Use a desktop browser for large or complex inputs.
Which workflow should you choose?
Use JSON to JSON Schema Generator for: Draft selection from legacy drafts through 2020-12 in the current UI. Use JSON to Function Calling Schema Generator for: Targets currently shown: OpenAI, Claude and Gemini.
Related tools
Select the target dialect, generate the draft and validate it with the same engine used in production.