1π
β
data.flatMap(Object.entries)
.flatMap(entry => Object.keys(entry[1])
.map(contribution => entry[0] + " " + contribution)
)
π:0
Do you mean something like this?
const data = [{
"TITANIC.AGE_CONTRIBUTION": {
"(0.419, 14.0)": 0.0764588776,
"(41.0, 50.0)": -0.0028983768,
"(14.0, 19.0)": 0.0126423091
}
},
{
"TITANIC.EMBARKED_CONTRIBUTION": {
"Q": 0.023986753511113696,
"C": 0.02789997960547538,
"S": -0.09335021246545774
}
}
];
data.forEach((arrayItem) => {
for (const [key, value] of Object.entries(arrayItem)) {
for (const valueKey of Object.keys(value)) {
console.log(`${key} ${valueKey}`);
}
}
})