Stream Schema
NPM Package
Streaming JSON parser with incremental schema validation. Parse LLM outputs token by token. Real-time partial results with type safety as data arrives.
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. LLM outputs often arrive as JSON, token by token. Current solutions wait for the complete JSON before they parse it. This wait gives a bad user experience. Other solutions use fragile regex hacks.
The Solution
stream-schema parses JSON incrementally as the data streams. It validates the data against a JSON Schema. It emits partial results that you can use to update your UI in real time.
Key Features
- Incremental Parsing: Parses JSON as it streams, with no wait for completion
- Schema Validation: Validates against JSON Schema draft-07 incrementally
- TypeScript Support: Full type inference from your schema
- LLM Error Recovery: Recovers from common LLM mistakes (trailing commas, unquoted keys)
- Event Callbacks: Real-time callbacks for field completions and validation errors
Tech Stack
- Language: TypeScript
- Build: tsup (ESM + CJS)
- Testing: Vitest (102 tests)
- Package: Published on NPM as
stream-schema
Live Demo
Open the live demo at v0-llm-output-parser.vercel.app