# json-event-parser

> A SAX-style JSON event parser

Latest version **1.0.0-beta.1** (published 2022-09-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install json-event-parser
pnpm add json-event-parser
yarn add json-event-parser
bun add json-event-parser
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-beta.1 |
| Published | 2022-09-05 |
| First published | 2022-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 28.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Tpt |
| Maintainers | rubensworks |

## Links

- npm: https://www.npmjs.com/package/json-event-parser
- Repository: https://github.com/Tpt/json-event-parser.js
- Homepage: https://github.com/Tpt/json-event-parser.js#readme
- Issues: https://github.com/Tpt/json-event-parser.js/issues
- npm.io page: https://npm.io/package/json-event-parser

## Dependencies (2)

- [buffer](https://npm.io/package/buffer.md) ^6.0.3
- [readable-stream](https://npm.io/package/readable-stream.md) ^4.0.0

## Recent versions

- 1.0.0-beta.1 (latest) — 2022-09-05
- 1.0.0-beta.3 (beta) — 2022-10-31
- 1.0.0-beta.2 — 2022-10-04

## README

# JSON Event Parser

[![Build status](https://github.com/comunica/json-event-parser.js/workflows/CI/badge.svg)](https://github.com/comunica/json-event-parser.js/actions?query=workflow%3ACI)
[![npm version](https://badge.fury.io/js/json-event-parser.svg)](https://www.npmjs.com/package/json-event-parser)

A streaming SAX-style JSON parser.

This is a fork of [`jsonparse`](https://github.com/creationix/jsonparse).


## Installation

```bash
$ npm install json-event-parser
```
or
```bash
$ yarn add json-event-parser
```

This package also works out-of-the-box in browsers via tools such as [webpack](https://webpack.js.org/) and [browserify](http://browserify.org/).

## Usage

Example:

```typescript
import {JsonEventParser} from 'json-event-parser';
import {Readable} from "stream";

Readable.from(['{"test": "fo', 'o"}'])
    .pipe(new JsonEventParser())
    .on("end", () => console.log('Parsing done!'))
    .on("error" => error => console.error(error))
    .on("data", event => console.log(`Event of type ${event.type}`));
```

The event fields are:
* `type`: the event type. Might be `"value"` (a plain value i.e. a string, a number, a boolean or null), `"open-array"` and `"close-array"` to mark that an array is opened and close, or `"open-object"` and `"close-object"` to mark the same thing with objects.
* `value`: used on the `"value"` type to store the value itself.
* `key`: used on the `"value"`, `"open-array"` and `"open-object"` to store the key in the parent object or the position in the parent array.

## License

This code is released under the [MIT license](http://opensource.org/licenses/MIT).

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