Turn a JSON Schema into provider-ready structured output

Paste a JSON Schema, choose a target and generate the snippet locally. The page names the keywords it had to leave out, checks whether OpenAI strict mode can be used, and sends nothing to a provider.

Runs locally in your browser
This tool processes all data locally in your browser.
JSON SchemaPaste a JSON Schema for the object you want an LLM to return. This tool converts the schema only; it does not send a prompt, schema, or API key anywhere.
Integration snippet

How to turn a JSON Schema into an LLM output snippet

The page reads one JSON Schema and writes the configuration each provider expects for structured output: an OpenAI response_format, an Anthropic tool definition, a Gemini generationConfig or a TypeScript interface. Conversion is a local walk over the schema tree, so no provider is contacted and no API key is involved.

Because the four targets do not accept the same keywords, the status line names every keyword the chosen target cannot carry, and the snippet is written without it. Read that line before pasting the snippet into a request: a dropped $ref or default changes what the model is allowed to return.

  1. Paste the JSON Schema into the left pane, or press Load example for a schema with an object, an enum and a nested array.
  2. Pick the target: OpenAI Structured Outputs, Anthropic tool input schema, Gemini response schema or TypeScript interface.
  3. Adjust Schema name when it has to match a tool name or an interface name in your codebase.
  4. Press Generate snippet and read the status line: it repeats what was left out, whether the OpenAI strict mode could be used, and whether the name had to be adjusted.
  5. Copy or download the result, and press Clear before working on the next schema.

What each target receives, and what this converter cannot carry

What each target receives

OpenAI gets a response_format object with a json_schema block; strict is written as true only when every object in the schema sets additionalProperties to false and lists all of its properties in required, because that is the shape OpenAI accepts in strict mode. Otherwise the snippet carries strict: false and a comment says why.

Anthropic gets a tool object whose input_schema is the converted schema, ready for the tools array. Gemini gets a responseSchema with uppercase types, const turned into a single-value enum and a nullable union turned into nullable. TypeScript gets an interface whose property names match the JSON keys exactly: keys that are not valid identifiers are quoted, unions such as type: ["string","null"] survive, and a root that is not an object becomes an export type alias.

Keywords this converter leaves out

Composition and reference keywords need a resolver, so $ref, $defs, anyOf, oneOf, allOf, not, if/then/else, patternProperties and prefixItems are not carried into any target. The constraints that the OpenAI and Anthropic outputs do keep, such as pattern, format, minimum or maxLength, are reported for Gemini, which accepts a narrower schema.

Nesting is followed eight levels below the root; anything deeper is replaced by an empty schema and the status line says so. TypeScript has no place for constraints such as minLength or pattern either: a type describes shape, it does not validate, so they are not part of the interface.

Names, failures and privacy

The Schema name is reduced to letters, digits, hyphens and underscores; an empty field becomes structured_response, names longer than 64 characters are shortened for the provider targets, and a TypeScript interface also receives a valid identifier, so a leading digit becomes _123report. Whenever the text had to change, the status line shows the name that was actually used.

A run that cannot produce a snippet - empty input, malformed JSON, an array, or an object without type or properties - reports the reason, with line and column for JSON errors, and clears the output pane, so an older snippet can never be mistaken for the current one. Nothing is uploaded: the schema, the generated code and the name stay in the browser.

Recent tools: