[Feature Request] Stream partial JSON tokens when using --json-schema

Resolved 💬 4 comments Opened Dec 27, 2025 by matthew-petty Closed Feb 14, 2026

Summary

When using --json-schema with --output-format stream-json --include-partial-messages, the CLI streams natural language text, but the actual JSON only appears in the final result.structured_output.

Request: Stream JSON tokens incrementally so consumers can parse and display partial objects as they're generated.

Current Behavior

claude --print --verbose --output-format stream-json --include-partial-messages \
  --json-schema '{"type":"object","properties":{"name":{"type":"string"}}}' \
  "Generate a person"

content_block_delta events contain natural language: "I've created a person..."

JSON only arrives at the end in result.structured_output.

Expected Behavior

Stream JSON tokens in delta events (similar to tool use input_json events):

{"type":"stream_event","event":{"delta":{"type":"input_json_delta","partial_json":"{\"name\":\"Jo"}}}

This enables partial JSON parsing for real-time UI updates as structured data generates.

Use Case

Building UIs that show structured data incrementally:

for await (const partial of streamObject({ schema })) {
  renderPreview(partial); // {}, {name: "Jo"}, {name: "John Doe"}
}

Prior Art

  • Tool use already streams input_json events with partial_json deltas
  • OpenAI Structured Outputs streams JSON tokens
  • Vercel AI SDK streamObject() provides partial updates

Environment

  • Claude Code: 2.0.76
  • macOS

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗