I’m working on a Google Maps routing application where I want to display employee names dynamically from a JSON response instead of static waypoint labels. My current code shows the last name only, and I’m struggling to correctly map each employee’s name to their respective waypoint marker.
Current Challenge
- I have a JSON response with employee trip data
- Need to replace static waypoint markers with dynamic employee names
- Existing code only displays last name
Example JSON Structure
var employeeRoutes = {
'status': 'success',
'data': [
{
'employeeId': '101',
'latitude': '12.9565226',
'longitude': '77.70730989999993',
'employeeName': 'Rachel'
},
{
'employeeId': '102',
'latitude': '12.9550587',
'longitude': '77.68279819999998',
'employeeName': 'Michael'
}
]
};
How can I modify my map rendering code to display each employee’s full name correctly?