Structured Output Schema Builder
Build the exact JSON shape you want an AI model to return, make it strict-mode ready, see a sample, check real replies against it and get TypeScript and Pydantic models.
Berjalan di browser Anda. File Anda tidak pernah keluar dari perangkat. Lihat cara memeriksa
…
Cara melakukannya
- 1Name the schema
Enter a name and choose strict or relaxed mode.
- 2Add fields
Build the fields with types, descriptions, formats and limits.
- 3Fix the checks
Clear errors and review warnings in the checks panel.
- 4Look at the sample
Read the sample output to confirm the shape makes sense.
- 5Validate real replies
Paste model output on the Validate tab and fix what fails.
- 6Export
Copy a request snippet, the JSON Schema, or the TypeScript and Pydantic code.
Tentang alat ini
Asking a model to answer in JSON works most of the time, and most of the time is not good enough for software. A missing field, an extra comment or a number sent as text breaks the code that reads the reply. Structured outputs solve this by giving the model a JSON Schema it must follow; OpenAI enforces it exactly in strict mode, Gemini accepts a response schema, and with Claude the same effect comes from forcing a single tool whose input schema is your output shape. Writing that schema is where teams struggle: strict mode wants every object closed and every field required, optional values must be expressed as nullable, and deep nesting or unsupported keywords cause errors that only appear at request time. This builder lets you design the shape with a form, keeps it strict-mode ready, shows a realistic sample, validates real model replies you paste in, and exports request snippets plus TypeScript and Pydantic models. It is the companion to designing extraction, classification and form-filling features.
Designing the shape
The root is always an object. Add fields of type string, number, integer, boolean, enum, array or object, give each a description the model will read, and set formats, patterns, lengths, ranges and item limits. Arrays of objects, such as invoice lines or extracted entities, are built by choosing array and then object for the item. Fields can be reordered and every edit can be undone. The invoice example shows a typical extraction schema with a currency enum, a date format and a list of line items.
Strict mode made simple
With strict mode on, the builder writes additionalProperties false on every object and puts every property in required. A field you mark as not required becomes nullable instead, so the model sends null when the value is missing. The checks panel then applies the documented strict rules and limits: the root must be an object and not a union, keywords like allOf, if and then, patternProperties and propertyNames are not allowed, and warnings appear when nesting gets deep, the property count gets large or enum values pile up.
Validating real replies
Paste a reply from any model on the validate tab. Code fences and leading prose are stripped with a warning, then the JSON is checked for wrong types, missing required properties, extra properties, values outside enums, ranges, lengths and patterns, and malformed dates or e-mail addresses. Each problem shows a path like $.line_items[2].quantity, which makes prompt or schema fixes quick.
Export
Request snippets cover the OpenAI Responses and Chat Completions formats, an Anthropic request with a forced tool, a Gemini request with responseMimeType and responseSchema, and plain JSON Schema 2020-12. Model fields are left as MODEL_ID placeholders for you to fill. TypeScript interfaces and Pydantic classes are generated from the same schema.
Limits
The validator supports the JSON Schema keywords that structured output features commonly use, not the full specification; $ref and definitions are not followed on import. Provider limits change over time, so confirm current numbers in their documentation. The tool does not call any model.
Contoh perhitungan
A team extracts data from supplier invoices. Their schema has vendor, invoice_number, invoice_date as a date, currency as an enum of USD, EUR, GBP, BDT and INR, line_items as an array of objects with description, quantity, unit_price and total, total_due, and an optional due_date. Strict mode turns due_date into a string-or-null field and lists all seven properties as required; the checks panel reports no errors. They paste a reply from a model in which the second line item has quantity "2" as text and there is an extra field called notes. The validator reports $.line_items[1].quantity should be number, got string, and $.notes property not allowed by the schema. They add a sentence to the prompt, switch on strict mode in their API call using the OpenAI snippet, and paste the generated Pydantic class into their Python service.
Fakta singkat
- Kategori: Pengembang & data
- Berfungsi di browser Anda, tanpa daftar, tanpa unggah.
- Masukan Anda tetap di perangkat Anda.
- Tersedia dalam bahasa Inggris.
- Konten terakhir ditinjau:
- Sumber resmi: OpenAI structured outputs, Gemini response schema docs and JSON Schema 2020-12
Pertanyaan yang sering diajukan
What is strict mode?
An OpenAI option that guarantees the reply matches your schema exactly, using constrained decoding. It requires closed objects, all properties listed as required and a limited set of keywords, which this builder handles.
How do I add an optional field in strict mode?
Untick required. The field stays in the required list but its type also allows null, so the model returns null when the information is missing.
Does it work with Claude and Gemini?
Yes. The Anthropic snippet defines one tool with your schema and forces it with tool_choice, so Claude returns arguments in that shape. The Gemini snippet sets responseMimeType to JSON with a responseSchema.
Can I validate replies from any model?
Yes. Paste the text of any reply. The page extracts the JSON, even inside code fences, and checks it against the schema you designed.
What code does it generate?
TypeScript interfaces and Python Pydantic models with field descriptions, enums as literal types and optional or nullable fields marked correctly.
Is anything uploaded?
No. Schema design, validation and code generation run in your browser, and the schema is saved only on this device.
