# pull-json-parse

> Parse a pull-stream with newline delimited JSON

Latest version **0.0.3** (published 2017-01-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install pull-json-parse
pnpm add pull-json-parse
yarn add pull-json-parse
bun add pull-json-parse
```

## 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.0.3 |
| Published | 2017-01-16 |
| First published | 2016-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | thomas-jensen |

## Links

- npm: https://www.npmjs.com/package/pull-json-parse
- Repository: https://github.com/srcagency/pull-json-parse
- Homepage: https://github.com/srcagency/pull-json-parse#readme
- Issues: https://github.com/srcagency/pull-json-parse/issues
- npm.io page: https://npm.io/package/pull-json-parse

## Recent versions

- 0.0.3 (latest) — 2017-01-16
- 0.0.2 — 2016-10-16
- 0.0.1 — 2016-10-14

## README

# JSON parse for pull-streams

The primary goal is to parse [ndjson](http://ndjson.org) (newline delimited
JSON) in a simple and efficient way.

However it also supports opening and closing brackets and commas which is
useful when working with an API that maintains backwards compatibility with
`JSON.parse` while allowing newline delimited parsing. In this case, the
format has to be strictly: `[\n<item>,\n<item>\n]`.

See [pull-json-stringify](https://github.com/srcagency/pull-json-stringify)
for producing either pure ndjson or `JSON.parse`-compatibel newline delimited
JSON, both parsable with this package.


```js
const pull = require('pull-stream');
const parse = require('pull-json-parse');

pull(
	pull.values([
		'{ name: 'Juliet', age: 22 }\n',
		'{ name: 'Romeo', age: 23 }\n',
	]),
	parse,
	pull.collect(( err, json ) => console.log(json))
	/*
	[ { name: 'Juliet', age: 22 }, { name: 'Romeo', age: 23 } ]
	*/
);

pull(
	pull.values([
		'[\n',
		'{ name: 'Juliet', age: 22 }\n',
		'{ name: 'Romeo', age: 23 }\n',
		']',
	]),
	parse,
	pull.collect(( err, json ) => console.log(json))
	/*
	[ { name: 'Juliet', age: 22 }, { name: 'Romeo', age: 23 } ]
	*/
);

pull(
	pull.values([
		'{',
		'"name"',
		':"Juli',
		'et","age"',
		':22',
		'}\n{"name":"Romeo",',
		' "age":23}',
	]),
	parse,
	pull.collect(( err, json ) => console.log(json))
	/*
	[ { name: 'Juliet', age: 22 }, { name: 'Romeo', age: 23 } ]
	*/
);
```

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