Stream Schema
NPM Package • January 9, 2026
A streaming JSON parser with incremental schema validation, perfect for parsing LLM outputs token by token. Get real-time partial results with type-safe validation as JSON streams in.
TypeScript
NPM
JSON Schema
LLM
Key Features
- •Incremental JSON parsing with partial value handling
- •JSON Schema draft-07 validation as data arrives
- •Full TypeScript type inference from schema
- •LLM error recovery (trailing commas, unquoted keys, single quotes)
- •Event callbacks for real-time UI updates
- •Memory efficient streaming for large JSON files
Stream Schema is a streaming JSON parser with incremental schema validation. When working with LLM outputs, you often receive JSON token by token, and current solutions require waiting for complete JSON before parsing (bad UX) or using fragile regex hacks.
The Solution
stream-schema parses JSON incrementally as it streams, validates against a JSON Schema, and emits partial results you can use to update your UI in real-time.
Key Features
- Incremental Parsing: Parse JSON as it streams without waiting for completion
- Schema Validation: Validate against JSON Schema draft-07 incrementally
- TypeScript Support: Full type inference from your schema
- LLM Error Recovery: Handle common LLM mistakes (trailing commas, unquoted keys)
- Event Callbacks: React to field completions and validation errors in real-time
Tech Stack
- Language: TypeScript
- Build: tsup (ESM + CJS)
- Testing: Vitest (102 tests)
- Package: Published on NPM as
stream-schema
Live Demo
Try it out at v0-llm-output-parser.vercel.app