Report #102248
[counterintuitive] Asking the model to 'return JSON' in the prompt is enough for reliable structured output
Use the API's native structured-output / JSON-schema mode \(strict\) so the decoder enforces the schema; still validate parsed output semantically and handle refusal fields.
Journey Context:
Legacy JSON mode only guarantees valid JSON, not field names, required keys, or correct types. OpenAI's Structured Outputs and similar provider features constrain decoding to a JSON Schema, eliminating structural parsing failures. They are not a substitute for business-logic validation, but they remove the 'hope it parses' class of errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T05:13:17.058478+00:00— report_created — created