Project / jsoncurrent

Structured JSON streaming for live AI interfaces

jsoncurrent is the transport layer I wanted every time a model was emitting structured output but the product needed to render before the final token landed.

TypeScriptPythonStreaming JSONMIT licensed

Why it matters

Token streams are not UI state.

jsoncurrent turns partial model output into patches a frontend can apply incrementally.

Emitterpatch stream
Collectorlive object
Use caseLLM product UIs

Library

What the library gives you

Patch-first streaming

Instead of waiting for a complete object, jsoncurrent emits structured patches as fields become available. UIs can start rendering real state immediately.

Collector on the other side

A collector reconstructs the latest object shape from incoming patches, so product code can consume stable state instead of raw token soup.

Built for real product streams

I created it for Vita after repeatedly needing LLM output to drive live interfaces, not just text boxes. The library now works across the TypeScript and Python stack.

Origin

I built it because I kept needing it

At Vita, I kept hitting the same problem: the model was emitting structured JSON, but mid-stream the object is incomplete — and incomplete JSON is unparseable.

You can't call JSON.parse() on a half-streamed JSON object. That meant buffering the entire response and only updating the UI once the last token landed — which defeats the point of streaming entirely. I wrote jsoncurrent to solve that: emit patches as each field becomes available, so the UI can assemble real state incrementally without ever touching a malformed string.

Demo

Watch the object assemble live

The demo below illustrates what happens under the hood to drive structured streaming interfaces.

jsoncurrent

live demo

Stream structured JSON incrementally, patch by patch, as it generates.

Watch raw tokens arrive on the left. Each structured patch lands in the middle. The assembled interface updates on the right without waiting for the final response.

raw token stream
tokens will appear here...
patches
waiting...
add
append
complete
assembled output
assembling...
patches 0
tokens 0
paths 0
idle