I have this value:
const sample = [{
name: "name",
value1: 1,
mean: 2,
create: 10,
age: "age",
player1: 20,
player2: 40,
sample: "sample",
player3: 30,
player4: 100,
}];
to be mapped into:
{
name: {
value: 1,
mean: 2,
create: 10
},
age: {
player1: 20,
player2: 40
},
sample: {
player3: 30,
player4: 100
}
}
I know what I can do is to map it manually but my list is around 50 so it's not possible.
Edit:
The key property will be if it's string and the number will be the values in that order
nameand which toage, currently its a hardcoded listplayer1andplayer2are fixed to age right, do you know what will be mapped to itObject.keyswill present the keys exactly in the order of their creation/assignment. And the environment that creates such objects has to ensure exactly such a viable and reproducible order as well.player1andplayer2with different values - the second value ofplayer1will replace the first one.