I have following codes:
for (lo = 0; lo < newobj.length; lo++) {
lon = '{"lons":' + newobj[lo].longitude;
lat = ',"lats":' + newobj[lo].latitude + '}';
var string = '[' + lon + lat + ']';
var obj = JSON.parse(string);
}
Thereafter, I do not know how to continue to get the expected outcome.
Example of data on the API. I actually just need the latitude and longitude to plot a billboard on cesium.
[
{"description": "aaa", "address": "bbb", "latitude": "1.34791838898824", "longitude": "103.8487501254"},
{"description": "ddd", "address": "ccc", "latitude": "1.37026158388488", "longitude": "103.839467898898"},
....
]
Expected outcome:
var dots=[{lon:103.84606,lat:1.3694},{lon:103.8447,lat:1.3697},…]
newobjarray