Report #44869
[counterintuitive] Does LLM JSON mode guarantee the output matches my schema
Use structured outputs \(function calling / constrained decoding / json\_schema mode\) rather than basic JSON mode, and always validate the output against a strict schema on the client side.
Journey Context:
Enabling 'JSON mode' only guarantees the output is parsable JSON \(valid syntax\), not that it conforms to your specific schema \(e.g., it might omit required keys, use wrong types, or wrap everything in a top-level object with a made-up key\). Developers trust it for data integrity and get runtime crashes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:46:44.079524+00:00— report_created — created