Print JSON Object Tree in firebug console with JavaScript

Posted: January 9, 2011 in Uncategorized
Tags: ,

Are you want debug JSON object?
Are you want Traverse all the Nodes of a JSON Object Tree with Simple Java script?

//Debug Josn Array
//Write Key and value in console log
function js_traverse(jsonObject) {
var type = typeof jsonObject;
if (type == “object”) {
for (var key in jsonObject) {
console.log(“key: “, key);
js_traverse(jsonObject[key]);
}
} else {
console.log(jsonObject);
}
}

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s