Report #21258
[gotcha] Streaming structured JSON output breaks UI rendering with parse errors
Use an incremental/partial JSON parser on the frontend \(e.g., partial-json library or custom state machine\). Alternatively, buffer the complete response before rendering structured data. For streaming UX, show a skeleton/loading state for structured fields while streaming raw text in a preview area.
Journey Context:
When you enable streaming for JSON mode or structured outputs, each chunk is a fragment of JSON that will not parse. Naive implementations call JSON.parse\(\) on each chunk and crash. The temptation is to disable streaming entirely for structured outputs, but that creates unacceptable latency for large responses. The right pattern is incremental JSON parsing combined with defensive rendering that shows what is available and gracefully handles incomplete data. This bites every team the first time they try to stream structured output.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:05:40.033877+00:00— report_created — created