use recursation in iife in js
(function printItems(items) {
if (!items) {
return;
}
for (var i = 0; i < items.length; i++) {
var item = items[i];
console.log(item.name + ' - ' + item.value);
printItems(item.items);
}
})(data);