Registry / serialization / nano-json-stream-parser

nano-json-stream-parser

JSON →
library0.1.2jsnpmunverified

This library (`nano-json-stream-parser`) provides a lightweight, pure JavaScript streamed JSON parser, weighing approximately 750 bytes (gzipped). Currently at version 0.1.2, it aims to offer functionality similar to larger alternatives like Oboe.js, achieving an 85% size reduction in bundle size, which is critical for highly optimized web applications or environments with strict resource constraints. The parsing mechanism involves feeding chunks of a JSON string to a function, which then invokes a callback whenever a complete JSON entity (object or array) has been fully parsed. However, a significant caveat is that the project explicitly states it lacks comprehensive tests and may contain buggy edge-cases, making it potentially unsuitable for mission-critical production environments without thorough internal validation. Its development appears to be inactive, with the last commit several years ago, indicating it is not actively maintained, nor does it have a clear release cadence, suggesting it's largely abandoned. Developers should be aware of these limitations when considering its use for new projects.

npm install nano-json-stream-parser
INSTALL
IMPORT
SIG · NANO-JSON-STREAM-P
N
nano-json-stream-parser
serializationjavascriptv0.1.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const parse = require('nano-json-stream-parser');
import parse from 'nano-json-stream-parser';
This package is primarily a CommonJS module. Direct ESM `import` statements may not work without a build step or explicit configuration in Node.js environments due to its age and structure.
parse
(No named export for the main functionality)
import { parse } from 'nano-json-stream-parser';
The primary functionality is exposed as the default export (a function) via CommonJS `module.exports`. There are no named exports from the top-level module.

Demonstrates how to initialize the streaming JSON parser and feed it chunks of a JSON string, showing how complete JSON objects are emitted via the provided callback. It also illustrates its behavior with fragmented and escaped JSON.

const njsp = require("nano-json-stream-parser"); // Callback is called when there is a complete JSON const parse = njsp((json) => { console.log('Parsed JSON:', JSON.stringify(json)); }); console.log('--- Parsing [1,2,3,4] ---'); parse('[1,2,3,4]'); console.log('--- Parsing [1,2,3,4] in chunks ---'); parse('[1,2'); parse(',3,4]'); console.log('--- Parsing object in chunks ---'); parse('{"pos": {"x":'); parse('1.70, "y": 2.'); parse('49, "z": 2e3}}'); console.log('--- Parsing string with escapes ---'); parse('[ "aaaa\"abcd\\u0123\\\\aa\/aa" ]');
Debug
Known issues
gotchaThe library explicitly states, 'This library has no tests yet and could contain buggy edge-cases.' This means it is not production-ready and may produce incorrect results or unexpected behavior in various scenarios.
fix
Thoroughly test the library for your specific use cases and data patterns. For critical applications, consider using a more robust and actively maintained streaming JSON parser or conducting a security audit if considering internal maintenance.
affects: >=0.1.0
breakingThe project appears to be abandoned with no recent commits or updates (last commit several years ago). This indicates a lack of ongoing maintenance, security patches, or support for new JavaScript features and environments.
fix
Migrate to an actively maintained library for long-term stability and security. If continued use is essential, consider forking the repository and providing internal maintenance.
affects: >=0.1.0
gotchaThe parser is designed to ignore invalid JSON fragments or malformed syntax without throwing an explicit error, as indicated by the example `parse("[::invalid_json_is_ignored::]")`. While this prevents crashes, it can lead to silent data loss or incomplete parsing if not explicitly handled by the consumer.
fix
Implement external validation or robust error-checking mechanisms if data integrity and explicit error signaling are critical requirements. Do not rely solely on this parser to signal all forms of malformed input.
affects: >=0.1.0
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
nano-json-stream-parser — npm install nano-json-stream-parser · libregistry