induwara.lk
induwara.lkDeveloper · AI

Structured Output JSON Schema Generator

Define the JSON shape you want a model to return once, then copy the provider-correct structured-output config for OpenAI response_format, Gemini responseSchema and Claude tool use. Strict-mode rules applied for you. No API key, no signup, runs in your browser.

By Induwara AshinsanaUpdated Jun 30, 2026
Build your response schema
Strict-mode verified

Used as OpenAI's json_schema.name and the Claude tool name · letters, digits, _ · 1–64 chars.

Optional. Becomes the Claude tool description.

Fields (5)

5 properties · depth 1 of 5 — within OpenAI limits.OpenAI strict mode: 1 optional field moved into "required" and re-typed nullable (e.g. ["string","null"]). Strict mode allows no optional fields."additionalProperties": false added to 1 object.

OpenAI config

Valid JSON · 51 lines
{
  "type": "json_schema",
  "json_schema": {
    "name": "extract_review",
    "strict": true,
    "schema": {
      "type": "object",
      "properties": {
        "sentiment": {
          "type": "string",
          "description": "Overall sentiment of the review",
          "enum": [
            "positive",
            "neutral",
            "negative"
          ]
        },
        "score": {
          "type": "integer",
          "description": "Rating from 1 to 5"
        },
        "summary": {
          "type": "string",
          "description": "One-sentence summary"
        },
        "tags": {
          "type": "array",
          "description": "Key topics mentioned",
          "items": {
            "type": "string"
          }
        },
        "reviewer_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Reviewer name if stated"
        }
      },
      "required": [
        "sentiment",
        "score",
        "summary",
        "tags",
        "reviewer_name"
      ],
      "additionalProperties": false
    }
  }
}

Raw JSON Schema

{
  "type": "object",
  "properties": {
    "sentiment": {
      "type": "string",
      "description": "Overall sentiment of the review",
      "enum": [
        "positive",
        "neutral",
        "negative"
      ]
    },
    "score": {
      "type": "integer",
      "description": "Rating from 1 to 5"
    },
    "summary": {
      "type": "string",
      "description": "One-sentence summary"
    },
    "tags": {
      "type": "array",
      "description": "Key topics mentioned",
      "items": {
        "type": "string"
      }
    },
    "reviewer_name": {
      "type": "string",
      "description": "Reviewer name if stated"
    }
  },
  "required": [
    "sentiment",
    "score",
    "summary",
    "tags"
  ]
}
Fields
5
Objects
1
Nesting depth
1
Optional fields
1

Sources cited: transform rules verified against OpenAI's Structured Outputs guide, Google's Gemini structured-output docs, Anthropic's tool-use docs, and JSON Schema Draft 2020-12. Full links in the references section below. Everything runs in your browser — no API key, nothing uploaded.

How it works

Three providers solve the same problem — making a model return parseable JSON instead of free-form prose — but each names and shapes the configuration differently. This generator splits the job into two deterministic steps: build one canonical JSON Schema from your fields, then apply each provider's documented rules to it.

The canonical schema is always an object — { type: "object", properties, required } — because OpenAI and Gemini both reject a non-object root. An enum field becomes { "type": "string", "enum": [...] }, and an array of strings becomes { "type": "array", "items": { "type": "string" } }. You can also paste a sample JSON object (types are inferred from the values) or a TypeScript interface (the ? marker maps to optional).

For OpenAI the generator follows the Structured Outputs rules: the schema is wrapped as { type: "json_schema", json_schema: { name, strict: true, schema } }, every object gets additionalProperties: false, and every property is promoted into required. Because strict mode forbids optional fields, any field you left optional is re-typed as a nullable union such as ["string", "null"].

For Gemini the same schema is emitted as the OpenAPI subset under generationConfig.responseSchema, with responseMimeType: "application/json". Gemini does not support additionalProperties, so it is dropped; field order is pinned with propertyOrdering and optional fields are marked nullable: true. For Claude, which has no response-format parameter, the schema becomes a single forced tool — input_schema plus tool_choice: { type: "tool", name } — or an assistant prefill of {.

Generation is referentially transparent: identical inputs always produce byte-identical output. Two checks back the credibility badge — after the OpenAI transform the tool asserts every object really has additionalProperties: false and a complete required list, and the Gemini output is checked to carry no additionalProperties with a propertyOrdering matching your declared order. The page also counts nesting depth (max 5) and total properties (max 100) against OpenAI's documented ceilings.

Worked examples

Review extraction — OpenAI strict mode

  1. Fields: sentiment (enum), score (int), summary (str), tags (string[]), reviewer_name (str, OPTIONAL)
  2. Canonical: object, 5 properties, required:[sentiment, score, summary, tags]
  3. Strict transform: additionalProperties:false added
  4. required promoted to all 5 fields
  5. reviewer_name re-typed ["string", "null"] (nullable union)
  6. Stats: 5 properties · depth 1 · 1 object — within limits

Same schema — Gemini vs Claude

  1. Gemini: responseSchema with propertyOrdering listing all 5 in order
  2. reviewer_name → nullable: true; additionalProperties dropped
  3. generationConfig.responseMimeType = application/json
  4. Claude (forced tool): one tool extract_review with input_schema
  5. tool_choice: { type: 'tool', name: 'extract_review' }

Nested invoice — depth and property counting

  1. Fields: invoice_no, date, total, line_items: [{ name, qty, price }]
  2. Paste the example JSON to infer the nested shape automatically
  3. total 1500.50 → number; qty 2 → integer (type inferred from value)
  4. OpenAI strict: additionalProperties:false on BOTH objects (root + item)
  5. Stats: 7 properties (4 + 3) · 2 objects · depth 3 of 5 — info, not a warning

Frequently asked questions

Sources & references

Each provider's transform rules were last cross-checked against the official docs on 2026-06-30. Provider limits and keywords change — the generator is updated when they do, but always confirm against the current docs for production code.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want a provider or schema keyword added?

Email me at [email protected] — most fixes ship within 24 hours.