JSON to JSON Schema Generator
Generate a starter model from JSON or XML locally.
Generate a starter model from JSON or XML locally.
Paste a JSON object into the input box and press Generate. The tool parses it with JSON.parse, walks the top-level keys, and writes a draft-07 schema in which every property is given a type derived from the value with JavaScript's typeof. It produces a skeleton you then flesh out, not a finished contract.
Input:
{ "name": "Ada", "age": 37, "active": true }
Output:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "number" },
"active": { "type": "boolean" }
}
}
| JSON value | Generated type | You should add |
|---|---|---|
"Ada" | string | minLength, format, pattern, enum |
37 | number | integer type, minimum, maximum |
true | boolean | nothing usually |
[1, 2] | object (from typeof) | change to array, add items |
{ "a": 1 } | object | a nested properties block |
null | object | the real type, or ["string", "null"] |
Also add a top-level "required" array once you know which fields are mandatory, and a "description" on important properties.
Use it to bootstrap an API request or response contract from a real payload, to give a validator like Ajv, jsonschema, or everit-json-schema something to check against, or to document the shape of a config file. Starting from a generated skeleton is faster and less error-prone than writing properties by hand.
The tool expects an object. Wrap a sample array in an object, generate, then move the property into an items block.
No. It only sets type. Add "format": "date-time", "email", "uri" and similar yourself.
Yes, the skeleton will accept it, because it only constrains types. It will also accept many payloads you would want to reject until you add required and constraints.
No. Everything runs in your browser and the JSON never leaves the page.