How to convert object containing Objects into array of objects
This works for me
var newArrayDataOfOjbect = Object.values(data)
In additional if you have key - value object try:
const objOfObjs = {
"one": {"id": 3},
"two": {"id": 4},
};
const arrayOfObj = Object.entries(objOfObjs).map((e) => ( { [e[0]]: e[1] } ));
will return:
[
{
"one": {
"id": 3
}
},
{
"two": {
"id": 4
}
}
]
var data = {
a:{"0": "1"},
b:{"1": "2"},
c:{"2": "3"},
d:{"3": "4"}
};
var myData = Object.keys(data).map(key => {
return data[key];
})
This works for me