Report #67692
[counterintuitive] json mode ensures valid schema output
Use structured outputs \(function calling or grammar-constrained decoding\) to enforce schema, not just basic JSON mode.
Journey Context:
'JSON mode' merely forces the output to be syntactically valid JSON \(starts with '\{', ends with '\}', no trailing commas\). It does NOT guarantee the keys match your expected schema, that required fields are present, or that data types are correct \(e.g., returning a string 'null' instead of null\). Structured outputs / constrained decoding force the model to generate tokens that strictly adhere to a provided JSON schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:06:18.280819+00:00— report_created — created