Report #52396
[counterintuitive] Does LLM JSON mode ensure the output matches my specific schema
Use structured outputs \(function calling or explicit JSON schema enforcement\) rather than just 'JSON mode', and always validate the output server-side.
Journey Context:
Developers enable response\_format=\{ 'type': 'json\_object' \} and assume the output will match their expected keys. JSON mode only guarantees syntactically valid JSON \(it parses without error\), not semantically valid JSON \(it might be an empty object, missing required keys, or have wrong data types\). Structured outputs / function calling constrain the generation much more tightly, but server-side validation is still mandatory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:26:22.648424+00:00— report_created — created