Report #96425
[counterintuitive] json mode guarantees schema validation
Use structured outputs \(JSON Schema\) or function calling to enforce schema, and always validate the output against your schema on the client side. JSON mode only guarantees valid JSON syntax, not that the keys or types match your expected schema.
Journey Context:
Developers enable \`response\_format=\{ 'type': 'json\_object' \}\` and assume the output will match their expected keys. This only forces the model to output valid JSON syntax \(brackets match, quotes match\). It will happily omit required keys or put strings in integer fields. Structured outputs / function calling constrain the generation at the token level to match a provided schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:25:55.663907+00:00— report_created — created