This is a monorepo for the @formkit/jsonreader package and its documentation site.
@formkit/jsonreader is a specialized utility for processing JSON data from streams in real-time. Unlike traditional JSON parsers that require the entire payload before processing, @formkit/jsonreader allows you to:
undefinedDual License:undefined
Each commercial project requires a separate license. See the documentation for more details.
packages/jsonreader: The ESM package for streaming JSON processingpackages/docs: Documentation site powered by Nuxt 3import { jsonReader, jsonPathReader } from '@formkit/jsonreader';
// Get a stream reader (e.g. from fetch API)
const response = await fetch('https://api.example.com/large-data.json');
const reader = response.body.getReader();
// Method 1: Process JSON as it arrives
for await (const partialData of jsonReader(reader, {
// Don't yield until these properties are available
required: ['user.id', 'metadata.timestamp'],
// Don't include these properties in partial results
silent: ['large_payload', 'image_data', 'items.*.details'],
// Add these values to every yielded result
assign: { source: 'api', processed: true }
})) {
console.log('Partial data:', partialData);
}
// Method 2: Extract specific paths as they become available
const paths = ['user.name', 'metadata.version', 'items.*.id'];
for await (const [value, path] of jsonPathReader(reader, paths)) {
console.log(`Path ${path} is available:`, value);
// Take immediate action on specific values
if (path === 'user.name') {
updateUsername(value);
}
}
This project uses pnpm workspaces for package management.
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Start the documentation site dev server
pnpm dev:docs
# Watch mode for jsonreader package
pnpm dev:jsonreader
# Run tests
pnpm test
The documentation site provides comprehensive guides and API references:
# Run the documentation site locally
pnpm dev:docs
See the jsonreader README for detailed API documentation.