Structured Output Playground

Validate schema-constrained JSON samples and copy provider request patterns without calling a model API.

Structured Output Workbench
Example Presets
Validation Result

Found 5 issue(s).

Path $.price
Issue Missing required field.
Path $.extra
Issue Unexpected field.
Path $.attributes[0].rank
Issue Unexpected field.
Path $.in_stock
Issue Expected boolean but received string.
Path $.sku
Issue Expected string but received number.
Provider Patterns
Provider-agnostic prompt
Use the target JSON structure as the contract and reject extra keys.
Return JSON only.
Use the target JSON structure as the contract for keys, nesting, arrays, and value types.
Do not wrap the result in markdown.
Do not add extra keys.

Target structure:
{
  "sku": "abc-123",
  "price": 19.99,
  "in_stock": true,
  "attributes": [
    {
      "name": "color",
      "value": "blue"
    }
  ]
}
OpenAI Responses API
Use text.format with a strict JSON schema to request direct structured output.
from openai import OpenAI

client = OpenAI()

response = client.responses.create(
    model="gpt-5",
    input="Return the response in the required JSON shape.",
    text={
        "format": {
            "type": "json_schema",
            "name": "structured_output",
            "strict": True,
            "schema": {
              "type": "object",
              "properties": {
                "sku": {
                  "type": "string"
                },
                "price": {
                  "type": "number"
                },
                "in_stock": {
                  "type": "boolean"
                },
                "attributes": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "value"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "sku",
                "price",
                "in_stock",
                "attributes"
              ],
              "additionalProperties": false
            },
        }
    },
)

print(response.output_text)
Anthropic prompt pattern
Paste the target structure verbatim and instruct the model to answer with JSON only.
You are returning structured data for a downstream parser.
Output JSON only.
Match the exact keys, nesting, and value types shown below.
If a field is unknown, return a valid placeholder of the same type.

Target structure:
{
  "sku": "abc-123",
  "price": 19.99,
  "in_stock": true,
  "attributes": [
    {
      "name": "color",
      "value": "blue"
    }
  ]
}