Prompt Engineering

Streaming Output & Format Coordination

LLMs output Token by Token. The same response content, in different formats, produces completely different streaming experiences. Select a scenario and click Play to observe the rendering differences across three formats.

Choose a Demo Scenario
Real-time Comparison: Three Formats
JSON Waiting
Raw stream Tokens (accumulating char by char)
⏳ Waiting for the complete JSON to arrive before parsing…
JSON is malformed mid-stream,
so it cannot be parsed or rendered incrementally
✓ JSON parsing complete (after full text arrives)
Markdown Waiting
Render area (character-by-character display)
⚠️ Although character-by-character display is smooth,
you cannot reliably
extract structured fields from Markdown
XML Custom Tags Waiting
Incremental parse-render (renders as soon as </tag> is captured)
Key Takeaways
JSON Streaming
Backend-friendly but poor for streaming:
Must wait for the full text to parse,
users see a loading state throughout
Markdown Streaming
Smoothest user experience:
Character-by-character display feels like typing,
but cannot extract structured fields for programmatic use
XML Streaming
Best of both worlds: streaming + structured
Captures </name> and renders immediately,
Claude's native recommended approach
Core Takeaway: XML captures tags → renders fields immediately; JSON waits for full text → parses once; MD displays char-by-char → cannot extract fields.