Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Last active May 10, 2019 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevewithington/d274fe2ce0ed8190fab13e1d7b1909a8 to your computer and use it in GitHub Desktop.
Save stevewithington/d274fe2ce0ed8190fab13e1d7b1909a8 to your computer and use it in GitHub Desktop.
Prettify JSON, the easy way!
// arbitrary js object:
var myJsObj = {a:'foo', 'b':'bar', c:[false,2,null, 'null']};
// using JSON.stringify pretty print capability:
var str = JSON.stringify(myJsObj, undefined, 4);
// Kudos: <https://stackoverflow.com/questions/26320525/prettify-json-data-in-textarea-input/26324037>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment