FewA few ways to do that...
1) 2 layersA two-layer for...in loop...
for (let key in validation_messages) { const vmKeys = validation_messages[key]; for (let vmKey in vmKeys) { console.log(vmKey + vmKeys[vmKey]); } } 2) Using Object.key
Object.keys(validation_messages).forEach(key => { const vmKeys = validation_messages[key]; Object.keys(vmKeys).forEach(key => { console.log(vmKeys + vmKeys[key]); }); }); 3) Recursive function
const recursiveObj = obj => { for(let key in obj){ if(!obj.hasOwnProperty(key)) continue; if(typeof obj[key] !== 'object'){ console.log(key + obj[key]); } else { recursiveObj(obj[key]); } } } And call it like:
recursiveObj(validation_messages);