Pretty-Print JSON Using JSON.stringify()
Did you know that JSON.stringify() takes additional parameters?
JSON.stringify(myObj, null, 4);
This will pretty-print your stringified JSON object using 4 spaces for indentation. The second parameter is a "replacer" param that determines what is kept or removed from the final string.
Written by Jason Edelman
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#