구조화 출력 플레이그라운드

모델 API를 호출하지 않고 스키마 제약이 적용된 JSON 샘플을 검증하고 제공업체별 요청 패턴을 복사합니다.

구조화 출력 작업 공간
예시 프리셋
검증 결과

5개 문제를 찾았습니다.

경로 $.price
문제 필수 필드가 없습니다.
경로 $.extra
문제 예상치 못한 필드입니다.
경로 $.attributes[0].rank
문제 예상치 못한 필드입니다.
경로 $.in_stock
문제 boolean를 예상했지만 string를 받았습니다.
경로 $.sku
문제 string를 예상했지만 number를 받았습니다.
제공업체별 패턴
제공업체 공통 프롬프트
대상 JSON 구조를 기준으로 삼고, 추가 키는 허용하지 마세요.
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
직접적인 구조화 출력을 요청하려면 엄격한 JSON 스키마와 text.format을 사용하세요.
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 프롬프트 패턴
기준 구조를 그대로 붙여 넣고 모델이 JSON만 출력하도록 지시하세요.
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"
    }
  ]
}