Ask HN: Prettyjson for browser?
4 comments
There are plugins or you could
console.log(JSON.stringify(jsonData, null, "\t"));
The above will pretty print also.
console.log(JSON.stringify(jsonData, null, "\t"));
The above will pretty print also.
This doesn't seem like it would print pretty to the DOM. From the console, you can just console.log a JSON fine. It's when you try to write to the DOM nicely is where I cannot find a good solution.
There are browser plugins for Google Chrome.
for Firefox: http://jsonview.com/
Also works with Chrome:
https://chrome.google.com/webstore/detail/jsonview/chklaanhf...
https://chrome.google.com/webstore/detail/jsonview/chklaanhf...
hmm, not looking for plugins though. I want to display a json to the dom not console.
https://www.npmjs.org/package/prettyjson
I found this but it's only for node and for the CLI. Doesn't translate well for the browser.