So I have an array with many different items in it. I know the names of the keys and I want to get
neededvalue, But the issue is that while I know that neededvalue is in item2.item3 in this case there may be a case where it is in item2.item3.item4.item5 or many other cases. I will always know the location of the neededvalue but it may be in multiple different json. So I was wondering if there way a way that I could find the value using a way that will allow me to use any array.
let list = {
"item1": "test",
"item2": {
"item3": {
"neededvalue": "neededvalue"
}
}
}
console.log(list);
console.log(list["item2"]["item3"]); // This gets the value but I don't want to have to add in brackets for ever value I want to check
//console.log(list["item2/item3"]) or console.log(list["item2.item3"]) both return undefined