I have the following JSON data retreived from a Java servlet. I would like to add each latitude and longitude (bottom two variables) to a javascript list so I can later plot them to a map. here is the code:
<c:set var="object" value="${json}" />
Minlon : <c:out value="${object.minlon}"/><br>
MinLat : <c:out value="${object.minlat}"/><br>
Maxlon : <c:out value="${object.maxlon}"/><br>
MaxLat : <c:out value="${object.maxlon}"/><br><br>
Stops : <br>
<c:forEach items="${object.stops}" var="stop">
Name : <c:out value="${stop.name}"/><br>
Longitude : <c:out value="${stop.longitude}"/><br>
Latitude: <c:out value="${stop.latitude}"/><br>
<br/>
</c:forEach>
sample JSON:
{
"minlon": -0.227758,
"minlat": 51.407351,
"maxlon": -0.027758,
"maxlat": 51.607351,
"searchlon": -0.127758,
"searchlat": 51.507351,
"page": 1,
"rpp": 3,
"total": 5939,
"request_time": "2018-04-26T14:02:38+01:00",
"stops": [
{
"longitude": -0.12673,
"latitude": 51.50716
},
{
"longitude": -0.12662,
"latitude": 51.50728
},
{
"longitude": -0.12741,
"latitude": 51.50812
}
]
}
could anyone tell me how I can do this? Thanks