Report #76249
[gotcha] Streaming AI responses with structured output \(JSON\) renders broken/invalid intermediate UI states
Use schema-aware partial parsing \(e.g., partial-json or stream-accumulating parsers\) to only render semantically complete keys/values. Never render raw streaming tokens when the target is structured data — buffer until you have parseable fragments, or use a parser that knows which fields are complete versus still generating.
Journey Context:
Developers stream JSON from AI for perceived responsiveness, but partial JSON is syntactically invalid. Users see \{"name": "Jo flash on screen — broken syntax, incomplete values, null fields popping into existence. This is worse than waiting 500ms for a complete response. The counter-intuitive insight: streaming structured output can actually feel slower and more broken than a brief loading state followed by a complete render, because each intermediate state is visibly wrong and triggers re-parsing and re-rendering. The right pattern is schema-aware streaming: parse incrementally, only surface fields that are semantically complete, and show a skeleton or placeholder for fields still being generated.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:34:46.346298+00:00— report_created — created