Last Updated: February 25, 2016
·
3.81K
· athieriot

Pretty print JSON with Node in the command line

A simple way to print nice and nested Json in the command line using Node.js is to use the "space" argument of JSON.stringify:

JSON.stringify(data, null, '\t')

{
    "foo": "lorem",
    "bar": "ipsum"
}