
An AI response can be perfectly formatted and completely wrong. That matters when its next reader is not a person, but software that will copy values into a database, build a report or prepare an action.
Structured outputs help an application receive predictable data instead of a paragraph it must untangle. They are genuinely useful. The mistake is treating a neat response as a verified one.
The distinction becomes clearer when we separate three questions: can the data be read, does it follow the agreed structure, and is its content correct?
Three checks that answer different questions
1. Parsing: is this valid JSON?
JSON is a text format for representing values such as objects, lists, strings and numbers. A parser checks whether the text follows its grammar. A missing quotation mark or misplaced comma can stop the parser from reading it.
Passing this check says nothing about the meaning of the values. A sentence claiming that a shop opens at midnight can be a perfectly valid string, whether or not the shop actually does.
2. Schema validation: does it fit the contract?
A schema describes the expected data. For example, an application might require a product name, an integer price and a currency selected from a fixed list. A validator compares the response with those rules. That is the role described in the official JSON Schema overview.
This catches a different class of problems: missing required fields, the wrong data type or a value outside an allowed set. But the contract must actually include the rule. Naming a field verified_price does not make its contents verified.
3. Content validation: does it match the evidence?
This is where the application checks the values against the source and its own rules. Is the price the one in the supplied catalogue? Does the product exist? Was a delivery estimate mistaken for an order date?
JSON Schema’s explanation of schemas makes a related distinction between structural checks and semantic checks that may require general-purpose code. In plain language: some checks need more than a description of the data’s shape.
A fictional example: the right shape, the wrong price
Imagine a fictional shop, Example Stationery, whose supplied catalogue contains this line:
Notebook A5: NGN 2,500. Delivery time: not stated.
Suppose an extraction task asks for a product string, a non-negative integer price, the currency NGN, and a delivery estimate that may be an integer or null. The AI returns:
{
"product": "Notebook A5",
"price": 25000,
"currency": "NGN",
"delivery_days": 2
}
This is valid JSON. It also satisfies those particular schema rules: the names and types fit, the price is non-negative, and the currency is allowed.
Yet two values are wrong. The price has an extra zero, and the source never promised two-day delivery. A schema that accepts non-negative integers has no reason to reject either number.
The evidence-supported extraction would use 2500 for the price and null for the unstated delivery time. Crucially, the surrounding application must define what null means here: “not supplied in the source”, rather than zero days or a failed request.
What structured outputs actually improve
In OpenAI’s terminology, JSON mode and Structured Outputs are not equivalent. JSON mode targets valid JSON; Structured Outputs additionally enforce a supported schema. The same documentation warns that structured responses can still contain mistakes. Applications also need separate handling for refusals and incomplete responses. See the Structured Outputs guide.
That is still a substantial improvement. Predictable fields make data easier to consume and reduce format-repair work. They do not turn generated values into evidence. Think of the schema as a form with rules about what can go in each box, not an inspector who knows whether every entry is true.
A more reliable way to use the result
For the fictional catalogue task, a practical design would make each layer explicit:
- Allow honest absence. Define how to represent missing information, and instruct the model not to fill gaps with guesses.
- Preserve the source. Keep the catalogue entry beside the extracted result so a reviewer or check can compare them.
- Check what code can check. Look up the product in the supplied catalogue and compare its price. Recalculate totals from accepted inputs instead of asking prose to do the accounting.
- Separate extraction from permission. A parsed object should not, by itself, authorize a purchase or overwrite a trusted record.
- Test plausible failures. Include extra zeros, missing information and conflicting entries in test cases, not just broken JSON.
These are design recommendations for this example, not a promise that every factual error can be detected automatically. Ambiguous evidence may still need human review.
The useful question is not simply “Did the AI return JSON?” It is “Which checks passed, and what have they actually established?” A valid shape is a good starting point. Trustworthy content requires its own work.