I'm currently looping through JSON data using nested forEach loops in TypeScript. However, I'm curious if there are simpler and more efficient approaches available in typescript or RXJS, especially since I am also iterating over an Observable in some cases. Check out my code snippet and stackblitz demo here
What I want to achieve is to retrieve objects from the JSON data that have a "type" property within the htmltypes array and inlineTags array. Can someone help me with a method to achieve this without using nested forEach loops?
content.data.areas.forEach(sectionBlock => {
sectionBlock.sections.forEach(obj => {
obj.htmltypes.forEach(val => {
console.log(val);
if (val.inlineTags.length > 0) {
val.inlineTags.forEach(tag => {
console.log(tag);
})
}
})
})
})