Report #44155
[counterintuitive] JSON mode guarantees valid schema and data types
Use Structured Outputs with \`strict: true\` \(or grammar-constrained decoding like Outlines/lm-format-enforcer\) for schema enforcement, and always validate the output with Pydantic/Zod on the client side before processing.
Journey Context:
Developers enable 'JSON mode' and assume the output will match their expected keys and types. JSON mode only guarantees the output parses as valid JSON \(no syntax errors\). The model can still output \`\{"data": "wrong\_type"\}\`, omit required fields, or hallucinate extra keys. The model is predicting tokens probabilistically, not instantiating objects. Without strict grammar constraints, it will happily output syntactically valid but semantically invalid JSON.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:35:06.197875+00:00— report_created — created