Can anyone help me with converting an array of this specific type?
place:
[
{
"_id": "xxxxx",
"loc": [
0: "xxx",
1: "xxx"
]
}
]
Into something like the following format:
place:
{
lat: "xxx"
lng: "xxx"
_id: "xxxxx"
}
I've attempted using javascript, but my code below didn't yield the desired result:
let object = {};
place.forEach(element => {
object[element[0]] = element[1];
});
I'm working in angular and need to find a way to convert the array of objects being displayed.