I have this normalized API response :
{
"result": "123",
"entities": {
"articles": {
"123": {
"id": "123",
"author": "1",
"title": "My awesome blog post",
"comments": [
"324"
]
}
},
"users": {
"1": {
"id": "1",
"name": "Paul"
},
"2": {
"id": "2",
"name": "Nicole"
}
},
"comments": {
"324": {
"id": "324",
"commenter": "2"
}
}
}
}
Are there any better ways to visualize/log/debug (an already normalized or while normalizing) a response other than console.log() used with JSON.stringify() ?
There are actually many NPM modules like pretty-print-json or json-beautify that can do this for you as well al libraries, although my favorite method for pretty-printing is still the console.log() paired with JSON.stringify() because you can easily use the remaining arguments for beautify in console.
JSON.stringify() provides you a replacer and a space args: