JSON Schema Generator
Paste example JSON — get an instant strict JSON Schema. Export for OpenAI tool calls, Anthropic tool use, or standard draft-07.
Paste or select an example JSON on the left — the schema appears here instantly.
Frequently Asked Questions
What is a JSON Schema, and why do I need one?
JSON Schema is a specification that describes the structure and constraints of a JSON document — what fields exist, their types, and which are required. OpenAI tool calls and Anthropic tool use both require a JSON Schema to define the shape of the data an LLM is expected to return, enabling structured, predictable output instead of free-form text.
How does the schema inference work?
The generator parses your example JSON and recursively inspects each value. Strings become `type: "string"`, whole numbers become `type: "integer"`, decimals become `type: "number"`, booleans become `type: "boolean"`, and null values become `type: "null"`. Objects become `type: "object"` with `properties` and `required` arrays. Array items are inspected and merged into a single item schema. All inference runs locally in your browser — no data is uploaded.
Is my JSON data sent to any server?
No. The entire schema generation runs in your browser using pure JavaScript. Your JSON never leaves your device and is never sent to any server or third party. The tool works fully offline after the first page load.
What does "additionalProperties: false" do?
When enabled, each object schema in the output includes `"additionalProperties": false`. This tells the LLM — and any JSON Schema validator — to reject any properties not listed in `properties`. This is required by OpenAI's Structured Outputs feature and is strongly recommended for robust LLM output schemas to prevent hallucinated extra fields.
What is the difference between the three export formats?
JSON Schema (draft-07) is the raw schema, suitable for any validator or documentation. OpenAI Tool Definition wraps the schema inside a `{ "type": "function", "function": { "name": ..., "parameters": ... } }` envelope, which you paste directly into the `tools` array of an OpenAI API call. Anthropic Tool Use wraps it in `{ "name": ..., "input_schema": ... }`, which you paste into the `tools` array of an Anthropic API call.
What if my JSON has arrays with mixed types?
If an array contains elements of different types (e.g., strings and numbers), the generator produces an `anyOf` schema for the item type, listing all observed types. This accurately describes the data but may need manual narrowing — ideally your LLM output arrays should contain one consistent type for cleaner schemas.
Does the generated schema pass OpenAI Strict Mode validation?
Enabling "additionalProperties: false" and using this tool's output gets you most of the way there. OpenAI Strict Mode also requires all properties to be listed in `required` — which this tool does by default — and does not support certain keywords like `anyOf` at the top level. Review the OpenAI documentation for Structured Outputs for any remaining constraints before deploying.