使用 Delphi XE8 System.JSON
,我无法解析 jsonarray
示例 Json:
{
"data":{
"current_condition":[
{
"cloudcover":"0",
"FeelsLikeC":"-9",
"FeelsLikeF":"15",
"humidity":"93",
"observation_time":"04:10 AM",
"precipMM":"0.0",
"pressure":"1007",
"temp_C":"-6",
"temp_F":"21",
"visibility":"10",
"weatherCode":"113",
"weatherDesc":[
],
"weatherIconUrl":[
],
"winddir16Point":"SE",
"winddirDegree":"130",
"windspeedKmph":"7",
"windspeedMiles":"4"
}
]
}
}
使用代码:
memores: TStringList;
currcond: TJSONObject;
memores2.Text := http.Get ('url');
JSONObject := TJSONObject.ParseJSONValue(memores2.Text) as TJSONObject;
Memores1.add('current_condition');
JSONObject2 := JSONObject.GetValue('data') as TJSONObject;
arrayjson := JSONObject2.ParseJSONValue('current_condition') as TJSONArray;
currcond := arrayjson.Items[0] as TJSONObject;
memores1.Add((currcond.GetValue('cloudcover').Value));