I have an API that return me many object like this
{ id : 1243, string: "things", bool: 1, date: "2021-21-11"}
{ id : 4233, string: "somethingselse", bool: 1, date: "2021-21-11"}
I can have many datas for the same ID as
{ id : 1243, string: "other", bool: 0, date: "2021-27-10"}
{ id : 4233, string: "somethings else again", bool: 1, date: "2021-21-11"}
So i made a function to group by id my datas to get something like
object = {
1243: [{
0: {
string: "things",
bool: 1,
date: "2021-21-11"
},
1: {
string: "other",
bool: 0,
date: "2021-27-10"
}
}]
object2 = {
4233: [{
0: {
string: "somethings else again",
bool: 1,
date: "2021-21-11"
}
}]
but now i want something like this
alldata = [{
1243: [{
"2021-21-11": {
string: "things",
bool: 1
},
"2021-27-10": {
string: "other",
bool: 0
}
}],
4233: [{
"2021-21-11": {
string: "somethings else again",
bool: 1,
}
}]
}]
i dont know how to do this, i tried to generate arrays, object but nothing great