<script>
function recur( my_array ){
if ( my_array && typeof my_array === "object" && Object.prototype.toString.call( my_array ) === "[object Object]" ) {
for (var Name in my_array) {
document.write(Name + " = " + recur( my_array[Name] ) + "<br>");
}
} else {
return my_array;
}
}
recur({
"lev1": {
"lev2": {
"lev3": {
"lev4": "test"
}
}
},
"alev1": {
"alev2": {
"alev3": {
"alev4": null
}
}
}
});
</script>