simple-json-formatter
v1.0.2
Published
A JSON formatter
Downloads
23
Readme
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
}
}