Report #35136
[gotcha] streaming structured JSON output unparseable fragments
For structured outputs, disable streaming and wait for the complete response to validate against your schema before rendering. If you must stream for perceived-latency reasons, use a streaming JSON parser that can handle incomplete JSON, and render a skeleton or loading state for the structured data that fills in as fields arrive. Never attempt to JSON.parse each streaming chunk.
Journey Context:
Streaming is great for free-text responses — users see words appearing and start reading immediately. But structured outputs like JSON, API responses, or form data cannot be meaningfully consumed until they are complete. A half-streamed JSON object is invalid and unparseable. Developers enable streaming for structured outputs because it is the default or because they want the perceived-latency benefit, then discover they cannot do anything with the partial data. The result is either broken rendering or a streaming UI that shows nothing until the end, defeating the purpose of streaming entirely. The fix is to recognize that structured and unstructured outputs need different streaming strategies: stream text, buffer structured data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:26:52.567797+00:00— report_created — created