JSON Schema Generator
Infer a JSON Schema (Draft-07) from example JSON data — objects get properties and required keys, arrays get a merged (or anyOf) item schema, and numbers are typed as integer or number based on the sample. Runs entirely in your browser.
Input
Output
Guides
Paste an example JSON value — an object, an array, or a plain scalar — and get back a Draft-07 JSON Schema that describes its shape. It's the fastest way to bootstrap a schema for API validation, config files, or documentation without writing one keyword at a time by hand.
How it works
The generator walks your example value recursively:
- Objects become
"type": "object"with apropertiesentry for every key, plus arequiredarray listing every key that was present. - Arrays become
"type": "array"with anitemsschema inferred from the elements. If every element shares the same shape (an array of similarly-structured objects, for example), the items merge into one schema — properties are the union across all elements, and a key only stays inrequiredif it appeared in every element. - Numbers are typed as
"integer"when the sample is a whole number, or"number"when it has a decimal — and a merge that sees both an integer and a fractional sample widens to"number", since an integer-only schema would reject the fractional one. - Mixed-type arrays (e.g.
[1, "two", true]) produce anitemsschema built fromanyOf, one branch per distinct type seen, deduplicated so repeated identical shapes don't produce repeated branches.
About required
The required array reflects only the example you pasted — it is not a guarantee that a field is always present in every real document your API or config will ever see. If a key is sometimes optional, remove it from required in the generated schema (or paste an example that omits it, so the array-merge logic naturally treats it as optional).
Settings
- Schema title (optional) — adds a
titlekeyword to the root of the generated schema, useful for naming the type when you paste the result into documentation or a schema registry.
Privacy
Everything runs client-side in your browser — your example JSON is never sent to a server.
What if my JSON has more variety than one example shows?
Paste a richer example — an array with a few differently-shaped elements is often enough to get useful anyOf branches and a realistic required list, since the merge logic already handles heterogeneous array elements. To check a document against the schema you get back, use the JSON Schema Validator. If you need a TypeScript type or a Zod schema instead of JSON Schema, see the JSON to TypeScript Converter or the JSON to Zod Schema Generator.
Use it from code
From 3 credits per callREST API
curl -X POST https://api.iotools.cloud/v1/tool/json-schema-generator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonInput": "{\"name\":\"Ada\",\"age\":30,\"active\":true}",
"schemaTitle": ""
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `json-schema-generator` tool (JSON Schema Generator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.