Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/format-json-stream
Formats a JSON stream to make it more readable by adding proper indentation and newlines.
https://github.com/thlorenz/format-json-stream
Last synced: 13 days ago
JSON representation
Formats a JSON stream to make it more readable by adding proper indentation and newlines.
- Host: GitHub
- URL: https://github.com/thlorenz/format-json-stream
- Owner: thlorenz
- License: mit
- Created: 2013-05-21T01:30:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-05T02:04:41.000Z (almost 11 years ago)
- Last Synced: 2024-12-10T08:26:55.298Z (about 1 month ago)
- Language: JavaScript
- Size: 176 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# format-json-stream [![build status](https://secure.travis-ci.org/thlorenz/format-json-stream.png)](http://travis-ci.org/thlorenz/format-json-stream)
[![browser support](https://ci.testling.com/thlorenz/format-json-stream.png)](https://ci.testling.com/thlorenz/format-json-stream)
Formats a JSON stream to make it more readable by adding proper indentation and newlines.
## As Commandline Tool
```sh
# default indent 2
curl https://raw.github.com/thlorenz/format-json-stream/master/package.json | format-json-stream | head -n 20# indent 8
curl https://raw.github.com/thlorenz/format-json-stream/master/package.json | format-json-stream --indent 8 | head -n 20# indent 4
curl https://raw.github.com/thlorenz/format-json-stream/master/package.json | format-json-stream -i 4 | head -n 20
```## As Library
```js
var format = require('format-json-stream')// formats with indent 2
process.stdin.pipe(format()).pipe(process.stdout);// formats with indent 4
process.stdin.pipe(format(4)).pipe(process.stdout);
```## Installation
npm install format-json-stream
# or as cli tool
npm install -g format-json-stream