Structured Outputs: Valid JSON Is Not the Same as a Correct Answer

Structured outputs give developers a defined shape for model responses. That is useful when an application needs data rather than a paragraph. It also creates an easy mistake: treating a response that fits the schema as an answer the application can trust.
A schema can establish that a field exists and has an allowed type. Whether its value matches the source is a separate question. Keeping those checks separate makes it easier to decide what the model should produce and what your application must verify.
Three checks with different jobs
Start with syntax. Can the response be parsed as JSON? A successful parse says nothing about whether the object contains the fields your application expects.
Next comes schema compliance. Does the object match the required structure, types, and constraints supported by the selected API? A response might parse correctly but fail this check because a required field is missing or a value has the wrong type.
The third check concerns meaning. Is the value supported by the input, and is it appropriate for the decision you are about to make? This requires evidence and application rules beyond the response's shape.

OpenAI's guide distinguishes JSON mode from Structured Outputs: both produce valid JSON, but only Structured Outputs enforce adherence to the supplied supported schema. That is an OpenAI-specific distinction, not a promise about every provider's JSON mode. The same guide warns that Structured Outputs can still contain mistakes.
These checks answer different questions. Passing one should not silently count as passing the others.
A date field cannot prove a date
Consider an illustrative task: extract event details from an announcement. The application asks for an event name and a date. This is a hypothetical example, not an observed model response.
If the announcement includes an unambiguous date, the application can compare the extracted value with that evidence. If the announcement says only that the event is coming soon, requiring a date string does not supply the missing information. A string can satisfy a structural requirement while containing an unsupported date.
Even when a date appears in the announcement, extracting it correctly remains a separate task. The schema's job is to describe the permitted output, not to establish that the model interpreted the announcement correctly.

For this workflow, I would define what counts as acceptable evidence before choosing the output fields. If the source does not provide a date, the application needs a missing-data path. Guessing is not a useful substitute for a complete record.
Make missing information a valid outcome
OpenAI's strict schema rules require all fields or function parameters to be marked required, and objects must use additionalProperties: false. Its documentation describes representing an optional value with a union that includes null. These are OpenAI's rules, not universal JSON Schema requirements.
A required field and a required value are different design choices. A record can always contain a date field while allowing its value to be null. The field's presence gives the consumer a predictable structure; the null value leaves room for the source to lack the information.
For the illustrative event extractor, the instructions should explain when to return no date and what to do when the input is unrelated to an event. OpenAI specifically warns that forcing unrelated input into a schema can cause hallucinations and recommends specifying how incompatible input should be handled.
Keep these instructions concrete. State that a missing date should remain missing rather than be inferred. Explain whether unrelated input should produce an empty result or another explicitly supported outcome. Choose a contract your application can handle without treating every response as a usable event.
Choose the interface before copying a schema
The providers in this discussion expose structured outputs through different request settings. Their shared use of JSON Schema does not make their request payloads interchangeable.
OpenAI distinguishes function calling, for connecting a model to application functionality, from structured response formatting, for giving the response itself a defined shape. Its Responses API examples configure the latter through text.format.
Anthropic's guide describes JSON outputs through output_config.format and strict tool use through strict: true. It says these capabilities can be used separately or together, and attributes schema compliance to constrained decoding.
Google's Gemini guide lists extraction, structured classification, and structured tool or API inputs as use cases. Its Interactions API examples use response_format with a MIME type and schema.
Pick the provider and API surface first. Then check its supported schema subset. Avoid designing around a keyword merely because it belongs to JSON Schema in general.
Schema helpers can reduce another source of confusion. OpenAI recommends native SDK helpers to avoid divergence between schemas and programming-language types, documenting Pydantic and Zod helpers. Google's guide also documents Pydantic and Zod schema definitions. Keeping those definitions consistent is useful, but it does not establish that an extracted value is true.
Handle responses that are not usable records
The consumer should check the response outcome before trying to use the expected object. OpenAI makes safety refusals programmatically detectable; its documentation example includes a refusal content item instead of the requested structured payload.

A refusal is one outcome to handle, not a name for every failure. As an engineering practice, check refusal and completion status before consuming data. After that, check source support and domain rules before allowing the values to drive an action. Do not assume a schema helper performs those checks for you.
Start with a small contract
For an initial structured-output workflow, use this checklist:
- Define only the fields the application needs.
- Give missing information and incompatible input explicit outcomes.
- Use the chosen provider's supported schema subset and request settings.
- Handle refusals and incomplete responses before reading the expected record.
- Check the extracted values against the source and application rules before acting.
For the event example, start by deciding how a missing date should appear and how the consumer should respond to it. That small decision gives you a concrete boundary to review: the model proposes a record, and the application decides whether the evidence is sufficient to use it.
Sources
- Structured model outputs · OpenAI
- Structured outputs · Anthropic
- Structured outputs · Google AI for Developers

