Report #91938
[gotcha] Structured output \(JSON mode\) responses cannot be progressively rendered during streaming
When using JSON/structured output modes, do not attempt to stream raw JSON to the user. Show a thinking or generating indicator during generation, then render the parsed result once the complete JSON arrives. If progressive feedback is essential, use a two-phase approach: stream a natural language explanation first, then generate structured output separately.
Journey Context:
Developers enable structured output for reliability, then expect to stream the result the same way they stream text. But JSON is not meaningful until complete — partial JSON cannot be parsed, and showing raw JSON fragments to users is worse than showing nothing. OpenAI's structured output supports streaming at the token level, but the streamed tokens form an incomplete JSON string until the final token arrives. The trap is building a UI that assumes streaming works identically for structured and unstructured output. The right call is to treat structured output generation as an atomic operation from the user's perspective, showing progress indicators rather than broken partial JSON.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:54:37.354300+00:00— report_created — created