# concatjson

> concatenated JSON streaming parser/serializer

Latest version **2.0.1** (published 2018-01-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install concatjson
pnpm add concatjson
yarn add concatjson
bun add concatjson
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2018-01-25 |
| First published | 2016-11-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/concatjson) |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Mani Maghsoudlou |
| Maintainers | manidlou |
| Keywords | concatenated-json, concatjson, json streaming |

## Links

- npm: https://www.npmjs.com/package/concatjson
- Repository: https://github.com/manidlou/concatjson
- Homepage: https://github.com/manidlou/concatjson#readme
- Issues: https://github.com/manidlou/concatjson/issues
- npm.io page: https://npm.io/package/concatjson

## Dependencies (2)

- [split2](https://npm.io/package/split2.md) ^2.1.1
- [through2](https://npm.io/package/through2.md) ^2.0.3

## 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

- 2.0.1 (latest) — 2018-01-25
- 2.0.0 — 2017-08-31
- 1.0.5 — 2017-05-25
- 1.0.4 — 2017-01-17
- 1.0.3 — 2016-11-24
- 1.0.2 — 2016-11-24
- 1.0.1 — 2016-11-24
- 1.0.0 — 2016-11-24

## README

concatjson
==========

[![npm](https://img.shields.io/npm/v/concatjson.svg?maxAge=2592000?style=flat-square)](https://www.npmjs.com/package/concatjson) [![travis](https://img.shields.io/travis/manidlou/concatjson/master.svg)](https://travis-ci.org/manidlou/concatjson)

<a href="https://github.com/feross/standard" style="float: right; padding: 0 0 20px 20px;"><img src="https://cdn.rawgit.com/feross/standard/master/sticker.svg" alt="Standard JavaScript" width="100" align="right"></a>

_Inspired by [https://github.com/maxogden/ndjson](https://github.com/maxogden/ndjson)_

`concatjson` is [concatenated JSON](https://en.wikipedia.org/wiki/JSON_Streaming) streaming parser/serializer for [Node.js](https://nodejs.org).

Install
-------

  `npm i concatjson`

Usage
-----

**concatjson.parse()**

 * `@return` {[Stream.Transform](https://nodejs.org/api/stream.html#stream_class_stream_transform)} a Transform stream

parses concatenated JSON stream and emits javascript objects.

_`somefile (contains concatenated JSON objects)`_

```js
{"foo":"bar"}{"qux":"corge"}{"baz":{"waldo":"thud"}}
```

```js
const fs = require('fs')
const cj = require('concatjson')

fs.createReadStream('./somefile')
  .pipe(cj.parse())
  .on('error', err => console.error(err))
  .on('data', obj => {
    // obj is a js object
  })
```
**concatjson.serialize()**

alias: `concatjson.stringify()`

 * `@return` {[Stream.Transform](https://nodejs.org/api/stream.html#stream_class_stream_transform)} a Transform stream

accepts objects and emits stringified JSON objects.

```js
const cj = require('concatjson')
const ser = cj.serialize()
ser.write({foo: 'bar'})
ser.end()
ser.on('data', dat => {
  // dat is stringified JSON
})
```

License
-------

MIT

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