Created
February 1, 2017 20:37
-
-
Save betweenbrain/d20caf586cde369777a7cf2c9b9a4a95 to your computer and use it in GitHub Desktop.
Recursively parse JSON object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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