{"id":14720,"library":"nano-json-stream-parser","title":"nano-json-stream-parser","description":"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.","status":"abandoned","version":"0.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/maiavictor/nano-json-stream-parser","tags":["javascript","json","parse"],"install":[{"cmd":"npm install nano-json-stream-parser","lang":"bash","label":"npm"},{"cmd":"yarn add nano-json-stream-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add nano-json-stream-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import parse from 'nano-json-stream-parser';","symbol":"default","correct":"const parse = require('nano-json-stream-parser');"},{"note":"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.","wrong":"import { parse } from 'nano-json-stream-parser';","symbol":"parse","correct":"(No named export for the main functionality)"}],"quickstart":{"code":"const njsp = require(\"nano-json-stream-parser\");\n\n// Callback is called when there is a complete JSON\nconst parse = njsp((json) => {\n  console.log('Parsed JSON:', JSON.stringify(json));\n});\n\nconsole.log('--- Parsing [1,2,3,4] ---');\nparse('[1,2,3,4]');\n\nconsole.log('--- Parsing [1,2,3,4] in chunks ---');\nparse('[1,2');\nparse(',3,4]');\n\nconsole.log('--- Parsing object in chunks ---');\nparse('{\"pos\": {\"x\":');\nparse('1.70, \"y\": 2.');\nparse('49, \"z\": 2e3}}');\n\nconsole.log('--- Parsing string with escapes ---');\nparse('[ \"aaaa\\\"abcd\\\\u0123\\\\\\\\aa\\/aa\" ]');\n","lang":"javascript","description":"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."},"warnings":[{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=0.1.0"},{"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.","message":"The 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.","severity":"breaking","affected_versions":">=0.1.0"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[],"ecosystem":"npm"}