I am currently developing an Android application which has a web backend. I can receive a JSON file which looks like the following:
[{"Latitude":"53.4041999","lontitude":"-6.377542"}]
I’m trying to figure out how to get the two coordinates from the JSON files and use them for mapping positions. Does anyone have any ideas how to get the two coordinates from the JSON file as doubles?
What you need to do is create
JSONObjectand just get double values usinggetDouble(name);Edit: Either create JSONArray(see @Glenn.nz comment below) or just do
JSONObject jObject = new JSONObject(response.substring(1, response.lenth()-1));