New Tool Radar

AI Concepts

How to Choose Between Structured Outputs and JSON Mode

Compare what each mode guarantees, then pick Structured Outputs when the shape matters and JSON mode when it does not.

Schematic with three steps: List what each mode guarantees; Check which mode your model supports; Pick by what your code needs.

Structured Outputs is the evolution of JSON mode, and the difference between them is the strength of the guarantee. Both ensure valid JSON is produced, but only Structured Outputs ensures the output adheres to your schema. Choosing well means knowing which guarantee your task actually needs, because the stronger mode is not available on every model.

What you need

  • A task that needs JSON from a model
  • The model you plan to call
  • A note of which fields your code reads

Step 1: List what each mode guarantees

JSON mode guarantees valid JSON syntax and nothing about shape: keys can be renamed, fields dropped, or extra fields added. Structured Outputs guarantees the JSON matches the supplied schema, including required fields and enum values.

Step 2: Check which mode your model supports

Structured Outputs is available in the latest large language models, starting with GPT-4o. Older models such as gpt-4-turbo and earlier may use JSON mode instead.

Step 3: Pick by what your code needs

Use Structured Outputs when downstream code reads specific fields. Use JSON mode only when any valid JSON will do and the model does not support the stronger mode. Test with a case that would drop a field, and check the field survives.

Worked example: synthetic missing-field test

The table below is a synthetic example. It shows the expected result of testing both modes; no API call was made.

Mode Valid JSON? Required field present?
JSON mode Yes No – priority field dropped
Structured Outputs Yes Yes – all fields present
Choice for this task Structured Outputs Shape matters to the code

Expected result (UNTESTED). JSON mode returns valid JSON but drops the priority field, while Structured Outputs keeps every required field. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Both modes are supported in the Responses API, Chat Completions API, Assistants API, Fine-tuning API and Batch API.
  • OpenAI recommends always using Structured Outputs instead of JSON mode when possible.
  • Neither mode checks that the values are true; a schema-correct answer can still be wrong.
  • Asking the model to reply as JSON in the prompt alone is a request, not a lock; only the response format constrains it.

Sources

See all