compact-json

Print JSON more compact


Keywords
json, format
Install
bower install compact-json

Documentation

Compact JSON Render

Renders:

data =
  string: 1
  list: [
    {a: 1, b: 2}
    {a: 1, b: 2, c: null}
    {a: 1, b: 2, c: {d: 3}}
    {list: [
      1, 3, 4,
      {x: 3, c: 6}
      1, 5, "string"
      ]}
  ]

into:

  string: 1
  list:
  - a: 1
    b: 2
  - a: 1
    b: 2
    c: null
  - a: 1
    b: 2
    c:
      d: 3
  - list:
    - 1
    - 3
    - 4
    - x: 3
      c: 6
    - 1
    - 5
    - "string"

Usage

In Node:

npm install --save compact-json
data = {} # some data...
{render} = require "compact-json"
console.log (render data)

Options

To avoid print too long content

render.hide = true

License

BSD