1.0.2 • Published 9 years ago

simple-json-formatter v1.0.2

Weekly downloads
7
License
ISC
Repository
github
Last release
9 years ago

Format JSON string with indent.

Typescript Example

let JSONFormatter = require("simple-json-formatter");

let a = {
    b: 42,
    c: "d",
    e: [
        "f",
        "g"
    ],
    h: {
        i: "j",
        k: null
    }
}

let json = JSON.stringify(a);
console.log(json);
let formattedJson = JSONFormatter.format(json, "\t");
console.log(formattedJson);

Output:

{"b":42,"c":"d","e":["f","g"],"h":{"i":"j","k":null}}
{
        "b": 42,
        "c": "d",
        "e": [
                "f",
                "g"
        ],
        "h": {
                "i": "j",
                "k": null
        }
}