I have encountered an issue with the positions of markers while using Google Maps in my app. Google requires data in a specific format as shown below:
const stops = [
[{ lat: 34.8791806, lng: -111.8265049 }, "Boynton Pass", 1],
[{ lat: 34.8559195, lng: -111.7988186 }, "Airport Mesa", 2],
[{ lat: 34.832149, lng: -111.7695277 }, "Chapel of the Holy Cross", 3],
[{ lat: 34.823736, lng: -111.8001857 }, "Red Rock Crossing", 4],
[{ lat: 34.800326, lng: -111.7665047 }, "Bell Rock", 5],
];
However, the data I am receiving from the API looks like this:
[{"id":40,"name":"3C Cinnah Cafe","longitude":32.855826,"latitude":39.896092},{"id":49,"name":"A.K. Simit Fırın Cafe","longitude":32.8469142,"latitude":39.
8871573},{"id":61,"name":"Aroma Coffee","longitude":32.7981522,"latitude":39.8943212}]
As a result, I need to rearrange the received data to match the Google template. Any suggestions on how to achieve this?