<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/stop-waiting-on-json-stream-structured-output-with-one-schema-ot4sa2u3v" -->

---
title: Stop Waiting on JSON: Stream Structured Output with One...
description: TanStack AI's useChat hook now accepts an outputSchema (Zod) parameter and returns typed partial and final objects directly, eliminating the need for manual...
canonical: https://daily.dev/posts/stop-waiting-on-json-stream-structured-output-with-one-schema-ot4sa2u3v
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Stop Waiting on JSON: Stream Structured Output with One Schema | daily.dev
og:description: TanStack AI's useChat hook now accepts an outputSchema (Zod) parameter and returns typed partial and final objects directly, eliminating the need for manual...
og:url: https://daily.dev/posts/stop-waiting-on-json-stream-structured-output-with-one-schema-ot4sa2u3v
og:image: https://api.daily.dev/og/posts/Ot4Sa2u3V.png
og:image:alt: Stop Waiting on JSON: Stream Structured Output with One Schema
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop Waiting on JSON: Stream Structured Output with One Schema

**[TanStack](https://daily.dev/sources/tanstack-blog)** · 5 min read · 0 upvotes · 0 comments

## Summary

TanStack AI's useChat hook now accepts an outputSchema (Zod) parameter and returns typed partial and final objects directly, eliminating the need for manual onChunk handlers, parsePartialJSON calls, and manual type casting when streaming structured LLM output. The release adds a proper discriminated union type for structured-output streams, tagged event variants for approval and tool-input events, per-chunk debug logging matching the plain chat path, and provider coverage across OpenAI, OpenRouter, Grok, Groq, and Ollama. The same outputSchema prop works identically across ai-react, ai-vue, ai-solid, and ai-svelte, keeping one hook rather than introducing a parallel useStructuredChat API.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tanstack.com/blog/streaming-structured-output>

## Questions this post answers

### How do I stream structured JSON output from an LLM with TanStack AI's useChat hook?

Pass a Zod schema as the outputSchema option to useChat, and it returns typed partial and final values directly, without writing an onChunk handler or calling parsePartialJSON manually. The same schema is used on the server when calling chat with outputSchema and stream: true, so both sides share one type definition. This works across ai-react, ai-vue, ai-solid, and ai-svelte.

_Track new TanStack AI streaming capabilities like this on daily.dev as you build LLM-powered UIs._

### Which LLM providers support TanStack AI's streaming structured output pipeline?

OpenAI, OpenRouter, Grok, Groq, and Ollama are all supported, since they ride on the shared openai-base adapter that now routes through the same streaming structured output pipeline. The summarize adapter received the same treatment, so structured summaries also stream end-to-end across these providers.

_Developers comparing LLM provider support for structured streaming can follow updates like this on daily.dev._

### What does StructuredOutputStream<T> look like in TanStack AI's chat function?

Calling chat with outputSchema and stream: true returns a StructuredOutputStream<T>, a discriminated union combining every regular StreamChunk with a single tagged StructuredOutputCompleteEvent<T> that carries a strongly-typed value.object. This removes the need for 'as' casts or 'any' when destructuring or switching on stream events.

_Keep up with typed streaming API changes like this one on daily.dev while building AI features._

## Similar posts on daily.dev

- [Spring AI : Structured Output](https://daily.dev/posts/spring-ai-structured-output-vawtiuqjk) · SivaLabs · 4 upvotes · 1 comments
- [A Guide to Structured Output in Spring AI](https://daily.dev/posts/a-guide-to-structured-output-in-spring-ai-fhz21l4ic) · Baeldung · 1 upvotes · 0 comments
- [Streaming Generative UI with JSON & React Server Components](https://daily.dev/posts/streaming-generative-ui-with-json-react-server-components-xizyryb1e) · SitePoint · 0 upvotes · 0 comments
- [Claude's Structured Outputs](https://daily.dev/posts/claude-s-structured-outputs-9ifsl3i9k) · Container Solutions · 1 upvotes · 0 comments
- [Structured Outputs in 2026: A Developer Guide](https://daily.dev/posts/structured-outputs-in-2026-a-developer-guide-4qqi5lmpc) · Alex CloudStar · 1 upvotes · 0 comments

---

Tags: [#react](https://daily.dev/tags/react), [#tanstack](https://daily.dev/tags/tanstack), [#zod](https://daily.dev/tags/zod)

[View this post on daily.dev](https://daily.dev/posts/stop-waiting-on-json-stream-structured-output-with-one-schema-ot4sa2u3v)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Stop Waiting on JSON: Stream Structured Output with One Schema","url":"https://daily.dev/posts/stop-waiting-on-json-stream-structured-output-with-one-schema-ot4sa2u3v","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/stop-waiting-on-json-stream-structured-output-with-one-schema-ot4sa2u3v"},"datePublished":"2026-08-23T12:20:50.729Z","dateModified":"2026-08-23T12:45:51.250Z","description":"TanStack AI's useChat hook now accepts an outputSchema (Zod) parameter and returns typed partial and final objects directly, eliminating the need for manual...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4dd61f1b315b979f662ba9b70ca3d612?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4dd61f1b315b979f662ba9b70ca3d612?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"TanStack","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"TanStack","logo":"https://media.daily.dev/image/upload/s--TVIrvIT7--/f_auto,q_auto/v1787487634/logos/tanstack-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/tanstack-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/stop-waiting-on-json-stream-structured-output-with-one-schema-ot4sa2u3v","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"react,tanstack,zod","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"TanStack","item":"https://daily.dev/sources/tanstack-blog"},{"@type":"ListItem","position":3,"name":"Stop Waiting on JSON: Stream Structured Output with One Schema"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/stop-waiting-on-json-stream-structured-output-with-one-schema-ot4sa2u3v#faq","mainEntity":[{"@type":"Question","name":"How do I stream structured JSON output from an LLM with TanStack AI's useChat hook?","acceptedAnswer":{"@type":"Answer","text":"Pass a Zod schema as the outputSchema option to useChat, and it returns typed partial and final values directly, without writing an onChunk handler or calling parsePartialJSON manually. The same schema is used on the server when calling chat with outputSchema and stream: true, so both sides share one type definition. This works across ai-react, ai-vue, ai-solid, and ai-svelte. Track new TanStack AI streaming capabilities like this on daily.dev as you build LLM-powered UIs."}},{"@type":"Question","name":"Which LLM providers support TanStack AI's streaming structured output pipeline?","acceptedAnswer":{"@type":"Answer","text":"OpenAI, OpenRouter, Grok, Groq, and Ollama are all supported, since they ride on the shared openai-base adapter that now routes through the same streaming structured output pipeline. The summarize adapter received the same treatment, so structured summaries also stream end-to-end across these providers. Developers comparing LLM provider support for structured streaming can follow updates like this on daily.dev."}},{"@type":"Question","name":"What does StructuredOutputStream<T> look like in TanStack AI's chat function?","acceptedAnswer":{"@type":"Answer","text":"Calling chat with outputSchema and stream: true returns a StructuredOutputStream<T>, a discriminated union combining every regular StreamChunk with a single tagged StructuredOutputCompleteEvent<T> that carries a strongly-typed value.object. This removes the need for 'as' casts or 'any' when destructuring or switching on stream events. Keep up with typed streaming API changes like this one on daily.dev while building AI features."}}]}
```

