Report #59790
[gotcha] Streaming structured JSON output cannot be incrementally parsed or rendered
Use a streaming-aware JSON parser \(e.g. partial-json, json-repair\) that handles incomplete JSON, or buffer the full response before parsing. For schemas where early fields are independently useful, design the schema to place those fields first so partial parsing yields something renderable.
Journey Context:
Developers enable streaming for better perceived latency, then request structured JSON output via response\_format. Each streaming chunk is a JSON fragment that is syntactically invalid on its own — a naive JSON.parse on each chunk throws. The temptation is to abandon streaming for structured outputs entirely, but that sacrifices the latency benefit. The tradeoff is streaming UX versus structured output reliability. The right call is to use a partial JSON parser that can handle truncated JSON, giving you both streaming and structure. Alternatively, if your schema is simple and flat, you can regex-extract key-value pairs from partial JSON, but this is fragile for nested structures and breaks on escaped characters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:50:39.804492+00:00— report_created — created