I currently have a Object which looks like so:
{
"Best Fare Description": {
"text": {
"value": "One",
"type": "TEXT"
}
},
"Brand ID": {
"text": {
"value": "test",
"type": "TEXT"
}
},
"Program ID": {
"text": {
"value": "test",
"type": "TEXT"
}
},
"Max Elapse Time": {
"integer": {
"value": 4,
"type": "INTEGER"
}
},
"Max Number of Connections": {
"integer": {
"value": 5,
"type": "INTEGER"
}
}
}
I am trying to iterate through the object and create an array of only the values. So for this object I would return an array of
["One","test","test",4,5]
What I've Tried:
data being the object
const tempList = [];
for (var key in data) {
for (var key2 in data[key]) {
for (var key3 in data[key][key2]) {
tempList.push(key3['value'])
}
}
}
However it seems like I am not doing something correct, as I get undefined or errors when I push into the array. Is there an easier/More Efficient way to accomplish this? Any help would be appreciated!