Skip to content

Instantly share code, notes, and snippets.

@betweenbrain
Created February 1, 2017 20:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betweenbrain/d20caf586cde369777a7cf2c9b9a4a95 to your computer and use it in GitHub Desktop.
Save betweenbrain/d20caf586cde369777a7cf2c9b9a4a95 to your computer and use it in GitHub Desktop.
Recursively parse JSON object
var str = '';
function traverse(o) {
if (typeof o == "object") {
for (var key in o) {
str += '<dt>' + key + '</dt>';
traverse(o[key])
}
} else {
str += '<dd>' + o + '</dd>';
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment