如何检索Json数组

时间:2014-04-17 19:25:14

标签: android json arrays

我试图从这个json中检索lat,lng值,但我无法帮助我检索它。

提前致谢。

{
    response: {
        Success: "1",
        lat: [
            "2",
            "3"
        ],
        lon: [
            "2",
            "3"
        ]
    }
}

1 个答案:

答案 0 :(得分:2)

 JSONObject jsonResponse = new JSONObject(yourString);
 JSONArray latitude= jsonResponse.getJSONArray("lat");

for (int i=0; i<latitude.length(); i++) {
    JSONObject lat= latitude.getJSONObject(i);
}
相关问题