i know it's too late but it was very easy Using recursive Function as you object seems to be the same on all other levels
Just reformatted the Object for clearer view
var source = [
{
"k": "01"
},
{
"k": "02",
"children": [
{
"k": "05"
},
{
"k": "06",
"children": [
{
"k": "ABC"
},
{
"K": "PQR"
}
]
},
{
"k": "07"
}
]
},
{
"k": "03"
}
]
function getChilds(source){
source.forEach(function(x,y){
console.log(x.k);
if( x.children != undefined){
getChilds(x.children);
}
})
}
and Finlay call getChilds(source); it will recursively Traverse the object and print the value of any node it visits
it's like traversing tree , reading about tree data structure will definitely help you understand better