# nano-json-stream-parser

> Lightweight, streamed JSON parser in 748 bytes

Latest version **0.1.2** (published 2017-05-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install nano-json-stream-parser
pnpm add nano-json-stream-parser
yarn add nano-json-stream-parser
bun add nano-json-stream-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2017-05-01 |
| First published | 2017-04-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 32 |
| Author | Victor Maia |
| Maintainers | maiavictor |
| Keywords | json, parse |

## Links

- npm: https://www.npmjs.com/package/nano-json-stream-parser
- Repository: https://github.com/maiavictor/nano-json-stream-parser
- Homepage: https://github.com/maiavictor/nano-json-stream-parser#readme
- Issues: https://github.com/maiavictor/nano-json-stream-parser/issues
- npm.io page: https://npm.io/package/nano-json-stream-parser

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.2 (latest) — 2017-05-01
- 0.1.1 — 2017-05-01
- 0.1.0 — 2017-04-30

## README

# nano-json-stream-parser

A complete, pure JavaScript, streamed JSON parser in about `750 bytes` (gzipped). It is similar to [Oboe.js](https://github.com/jimhigson/oboe.js/), a streaming JSON micro-library with a size of `4.8kb` (gzipped). While that alone isn't much, sizes add up quickly when you stack many libs. This lib achieves a 85% size reduction, while still offering the same main functionality. Uses ES6 arrows.

## Install

    npm i nano-json-stream-parser

## Usage

Usage is self explanatory:

```javascript
const njsp = require("nano-json-stream-parser");

// Callback is called when there is a complete JSON
const parse = njsp((json) => console.log(json));

parse('[1,2,3,4]');

parse('[1,2');
parse(',3,4]');

parse("[::invalid_json_is_ignored::]");

parse('{"pos": {"x":');
parse('1.70, "y": 2.');
parse('49, "z": 2e3}}');

parse('[ "aaaa\\"abcd\\u0123\\\\aa\\/aa" ]')
```

Output:

```
[ 1, 2, 3, 4 ]
[ 1, 2, 3, 4 ]
{ pos: { x: 1.7, y: 2.49, z: 2000 } }
[ 'aaaa"abcdģ\\aa/aa' ]
```

## Disclaimer

This library has no tests yet and could contain buggy edge-cases.

---
_Source: https://npm.io/package/nano-json-stream-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
