I'm currently facing some challenges with organizing map waypoints, defined by latitude/longitude pairs, within a JSON array.
This is the progress I've made so far.
var llData = {};
var waypointData = {};
for (i = 0; i < routeArray.length; i++) {
llData['waypoint'+i] = [{"latitude" : routeArray[i].latLng.lat},{"longitude" : routeArray[i].latLng.lng}];
waypointData.push = llData;
}
The provided code snippet is designed to cycle through multiple latitude and longitude pairs, adding them all to the waypointData array. However, the output that I am receiving is as follows:
{"push":{"waypoint1":[{"latitude":-27.47577},{"longitude":153.01693}]}}
It appears to only include the final latitudinal and longitudinal pair out of the four initially provided.