Tools / JSON to JSON Schema
JSON to JSON Schema
Paste a JSON example — an API response, a request body, a config file. Get a JSON Schema and a TypeScript type. Nothing leaves your browser.
Example
Input:
{
"id": 1042,
"email": "ada@example.com",
"createdAt": "2026-11-02T09:30:00Z",
"tags": [
"beta"
]
}JSON Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"email": {
"type": "string",
"format": "email"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"id",
"email",
"createdAt",
"tags"
]
}What the converter infers
- Types —
string,integervsnumber,boolean,null,objectandarray. - Required fields — a key is required if it appears in every object at that spot. Paste an array of several examples to show which fields are optional.
- Nullable fields — a value that is sometimes
nullbecomes"type": ["string", "null"]. - Formats — strings that look like
email,date-time,date,urioruuidget aformat. - Arrays — all items are merged into one
itemsschema; mixed items becomeanyOf.
The output targets JSON Schema draft 2020-12, the version used by OpenAPI 3.1 and by MCP tool definitions.
Tips for a better schema
- Use several examples. One object can’t tell which fields are optional; an array of three can.
- Add descriptions by hand. Inference can’t know what a field means. For APIs and especially for AI tools, a one-line
descriptionper field matters more than anything else. - Tighten what you can. Add
enumfor fixed values,minimum/maximumfor numbers andmaxLengthfor strings before using the schema to validate input. - Strict objects (
additionalProperties: false) reject unknown keys — good for request bodies, risky for third-party responses that may add fields.
Where JSON Schema is used
- Validating request bodies in an API (Ajv in JavaScript,
jsonschemain Python). - OpenAPI request and response definitions.
- MCP tools and LLM function calling: the model reads the input schema to decide how to call a tool.
- Form generators and editor autocompletion for config files.
In Wisp, every function has an input and output schema; they become its OpenAPI definition, its MCP tool definition and typed autocompletion in the SDK.