https://github.com/madnight/ndjson-to-json
Converts NDJSON to JSON
https://github.com/madnight/ndjson-to-json
convert json ndjson nodejs npm-package
Last synced: 3 months ago
JSON representation
Converts NDJSON to JSON
- Host: GitHub
- URL: https://github.com/madnight/ndjson-to-json
- Owner: madnight
- License: mit
- Created: 2017-01-13T21:07:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-02T18:44:26.000Z (over 4 years ago)
- Last Synced: 2024-11-14T02:06:52.126Z (11 months ago)
- Topics: convert, json, ndjson, nodejs, npm-package
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 17
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ndjson-to-json
Converts NDJSON to JSONThe opposite of the package [json-to-ndjson](https://www.npmjs.com/package/json-to-ndjson)
NDJSON stands for Newline delimited JSON and is a convenient format for storing or
streaming structured data that may be processed one record at a time.
It works well with unix-style text processing tools and shell pipelines.
It's a great format for log files. It's also a flexible format
for passing messages between cooperating processes.
Its also the download format that is used in Google Big Query.http://ndjson.org
# Installation
`npm install -g ndjson-to-json`# Usage
Print json to stdout: `ndjson-to-json ndjson-file.json`Output json to a new file: `ndjson-to-json ndjson-input.json -o output.json`
Use with npx without install: `npx ndjson-to-json file.json`
# Example
Github Licenses downloaded from Google BigQuery in NDJSON format
```JavaScript
{"license":"mit","count":"1551711"}
{"license":"apache-2.0","count":"455316"}
{"license":"gpl-2.0","count":"376453"}
{"license":"gpl-3.0","count":"284761"}
{"license":"bsd-3-clause","count":"161041"}
{"license":"bsd-2-clause","count":"57412"}
{"license":"unlicense","count":"43899"}
{"license":"lgpl-3.0","count":"38213"}
{"license":"agpl-3.0","count":"38034"}
{"license":"cc0-1.0","count":"28600"}
{"license":"epl-1.0","count":"24074"}
{"license":"lgpl-2.1","count":"23872"}
{"license":"isc","count":"17690"}
{"license":"mpl-2.0","count":"17421"}
{"license":"artistic-2.0","count":"9413"}
```Github Licenses after converstion with ndjson-to-json to JSON
```JavaScript
[{"license":"mit","count":"1551711"},{"license":"apache-2.0","count":"455316"},{"license":"gpl-2.0","count":"376453"},{"license":"gpl-3.0","count":"284761"},{"license":"bsd-3-clause","count":"161041"},{"license":"bsd-2-clause","count":"57412"},{"license":"unlicense","count":"43899"},{"license":"lgpl-3.0","count":"38213"},{"license":"agpl-3.0","count":"38034"},{"license":"cc0-1.0","count":"28600"},{"license":"epl-1.0","count":"24074"},{"license":"lgpl-2.1","count":"23872"},{"license":"isc","count":"17690"},{"license":"mpl-2.0","count":"17421"},{"license":"artistic-2.0","count":"9413"}]
```