Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including jsonmatter with all npm packages installed. Try it out:

var jsonmatter = require("jsonmatter")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

jsonmatter v2.1.1

JSON formatter tool by stream

README

NPM version Build Status Coverage Status

jsonmatter is a JSON formatter tool by stream.

INSTALL

$ npm install jsonmatter -g

USAGE

Node:

const tokenizer = require('json-tokenizer');
const jsonmatter = require('jsonmatter');

const indent = '\t';

fs.createReadStream(path.resolve(__dirname, './source.json'))
  .pipe(tokenizer())
  .pipe(jsonmatter(indent))
  .pipe(process.stdout);

cli:

$ cat tmp.json | jsonmatter --indent 4

Vim:

autocmd FileType json setlocal formatprg=jsonmatter
:help gq
:help formatprg
:help formatexpr

OPTIONS

-i, --indent

default indent is 2 spaces, you can also use ' ' or '\t'.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free