我想从下面给出的数据中解析一个特定的数组,特别是太阳能:
{
"Month":
{"1":"January",
"2":"February",
"3":"March",
"4":"April",
"5":"May",
"6":"June",
"7":"July",
"8":"August",
"9":"September",
"10":"October",
"11":"November",
"12":"December"},
"Air":
{"1":"26.6",
"2":"26.9",
"3":"27.2",
"4":"27.6",
"5":"27.6",
"6":"27.1",
"7":"26.7",
"8":"26.5",
"9":"26.5",
"10":"26.8",
"11":"26.7",
"12":"26.4"},
"Humid":
{"1":"79.5%",
"2":"75.6%",
"3":"75.8%",
"4":"75.9%",
"5":"77.5%",
"6":"78.2%",
"7":"79.0%",
"8":"81.5%",
"9":"80.5%",
"10":"77.2%",
"11":"76.7%",
"12":"79.7%"},
"Solar":
{"1":"5.87",
"2":"6.51",
"3":"6.77",
"4":"6.42",
"5":"5.51",
"6":"4.86",
"7":"4.95",
"8":"5.09",
"9":"5.92",
"10":"6.22",
"11":"6.12",
"12":"5.82"},
"Atm":
{"1":"101.1",
"2":"101.1",
"3":"101.1",
"4":"101.0",
"5":"101.0",
"6":"101.0",
"7":"101.1",
"8":"101.1",
"9":"101.2",
"10":"101.2",
"11":"101.2",
"12":"101.2"},
"Wind":
{"1":"3.7",
"2":"3.9",
"3":"3.0",
"4":"2.9",
"5":"3.7",
"6":"4.0",
"7":"3.5",
"8":"3.7",
"9":"3.0",
"10":"3.7",
"11":"3.9",
"12":"3.4"},
"Earth":
{"1":"28.5",
"2":"28.6",
"3":"29.3",
"4":"30.0",
"5":"29.9",
"6":"29.5",
"7":"29.3",
"8":"29.0",
"9":"29.1",
"10":"28.9",
"11":"28.5",
"12":"28.4"},
"HDD":
{"1":"0",
"2":"0",
"3":"0",
"4":"0",
"5":"0",
"6":"0",
"7":"0",
"8":"0",
"9":"0",
"10":"0",
"11":"0",
"12":"0"},
"CDD":
{"1":"514",
"2":"477",
"3":"532",
"4":"529",
"5":"545",
"6":"511",
"7":"516",
"8":"509",
"9":"495",
"10":"519",
"11":"502",
"12":"509"}
}
我试图了解如何使用不同的教程来做到这一点,但我似乎无法继续前进。我只需要提取它JSONArray
并将其转换为String
数组并将这些值存储到变量中。现在,我能够做到这一点:
public JSONObject solardata() throws ClientProtocolException, IOException, JSONException {
StringBuilder sb = new StringBuilder(URL);
HttpGet get = new HttpGet(sb.toString());
HttpResponse r = client.execute(get);
int status = r.getStatusLine().getStatusCode();
if (status == 200) {
HttpEntity e = r.getEntity();
这之后我该怎么办?我怎样才能取到JSONArray
?