Report #83987
[gotcha] Streaming JSON or structured AI output creates a perceived latency spike with no progressive rendering
Use partial-object streaming strategies: adopt tools like Vercel AI SDK's streamObject which yields progressively valid partial objects via JSON path diffs. Alternatively, stream a text preview to the user while parsing the structured object in the background, then swap in the rendered structured view once complete.
Journey Context:
When you request structured output \(JSON, function call arguments\) from an LLM with streaming enabled, tokens arrive incrementally but the JSON is syntactically invalid until complete. You cannot parse or render a half-finished JSON object. This silently defeats the entire purpose of streaming — the user sees nothing until the full response lands, creating a UX that is worse than non-streaming text \(which at least shows a loading state\). The gotcha: developers enable streaming for structured output expecting progressive rendering benefits, but get zero visual benefit and added implementation complexity. The model is still streaming tokens, but the UI cannot use them. The fix requires either a streaming-aware structured parser \(streamObject pattern\) that can yield partial valid objects, or a dual-channel approach where text streams visually while structure builds in the background.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:33:50.051584+00:00— report_created — created