我得到的所有资源都是JSONObject从JSONArray. 但在这种情况下,我想获得“温度”的温度。我不认为它是数组的一部分。我怎么能得到那个?
{
"coord":{
"lon":85.17,
"lat":26.67
},
"weather":[
{
"id":500,
"main":"Rain",
"description":"light rain",
"icon":"10d"
}
],
"base":"stations",
"main":{
"temp":31.09,
"pressure":1004.15,
"humidity":83,
"temp_min":31.09,
"temp_max":31.09,
"sea_level":1010.39,
"grnd_level":1004.15
},
"wind":{
"speed":3.66,
"deg":107.5
},
"rain":{
"3h":0.202
},
"clouds":{
"all":64
},
"dt":1534148929,
"sys":{
"message":0.0048,
"country":"IN",
"sunrise":1534117810,
"sunset":1534165068
},
"id":1273043,
"name":"Dhaka",
"cod":200
}
我已经尝试过-(我是 JSON 新手)
JSONObject jsonObject = new JSONObject(s);
JSONObject main = jsonObject.getJSONObject("main");
JSONObject temp = main.getJSONObject("temp");
慕容3067478
红颜莎娜
慕码人8056858
相关分类