How to convert an array of this type:
place:
[
{
"_id": "xxxxx",
"loc": [
0: "xxx",
1: "xxx"
]
}
]
To something like this:
place:
{
lat: "xxx"
lng: "xxx"
_id: "xxxxx"
}
Using javascript, I tried something like
let object = {};
place.forEach(element => {
object[element[0]] = element[1];
});
but it did not work for me, I am using angular to make a method and I need to convert the array of objects that I am showing
["0":"xxx"
won't parse - so, not sure how you managed to run anything against that input – Bravo