Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Formats a JSON stream to make it more readable by adding proper indentation and newlines.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
README.md

format-json-stream build status

browser support

Formats a JSON stream to make it more readable by adding proper indentation and newlines.

As Commandline Tool

# 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

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
Something went wrong with that request. Please try again.