Displaying JSON as a Table in Dev Tools Console
If you are dealing with blobs of JSON in your app and need a way to easily visually inspect it, here's a simple method:
var team =
[{"name":"Jason Nissen","username":"jasonnissen","badges_count":0,"endorsements_count":0}, {"name":"Chris Rouw","username":"chrisrouw","badges_count":0,"endorsements_count":0},{"name":"Chad Feldmann","username":"cfeldmann","badges_count":0,"endorsements_count":0},{"name":"Tyler Kane","username":"tykane91","badges_count":0,"endorsements_count":0},{"name":"Mike Cole","username":"colemike","badges_count":4,"endorsements_count":0},{"name":"Lana Wrage","username":"farreachlana","badges_count":0,"endorsements_count":0}];
console.table(team);
produces a simple, sortable table in your dev tools console.
See it in action here: http://jsfiddle.net/colemike/5qrgz8hs/
Written by Mike Cole
Related protips
1 Response
Works also great with arrays ..
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Related Tags
#json
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#