Report #94993
[counterintuitive] Enabling JSON mode guarantees the LLM output is valid and usable
Implement application-level validation \(e.g., Pydantic/JSON Schema\) on the parsed JSON; use Structured Outputs or tool calling for strict schema adherence, treating basic JSON mode only as a syntactic safeguard.
Journey Context:
Developers enable \`response\_format: \{ "type": "json\_object" \}\` and assume the output is safe to consume. JSON mode forces the model to output valid syntax \(matching brackets, quotes\), but it does not guarantee the schema \(missing required keys\) or the semantic validity \(e.g., \`age: -5\`, \`status: "florp"\`\). The model can still hallucinate values that break your application logic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:01:28.828520+00:00— report_created — created