Getting content from JSON string
I am currently developing an Android application which has a web backend. I can receive a JSON file which looks like the following:
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?
JSONObject jObject = new JSONObject(response); double lat = jObject.getDouble("Latitude"); double lng = jObject.getDouble("lontitude");
What you need to do is create JSONObject and just get double values using getDouble(name);
Edit: Either create JSONArray(see @Glenn.nz comment below) or just do JSONObject jObject = new JSONObject(response.substring(1, response.lenth()-1));