我想解析这个页面
该页面具有如下 json 数据:
{"List":[{"num":"1","name":"hello","ox_score":"30","between_score":"30","order_score":"30","total_score":"90"}]}
我尝试了下面的代码。(我使用过JSON.NET
)但我对“列表”感到担忧,我也尝试了 JArray 和... o["Lists"]["name"] 但我无法得到正确的结果。下面的代码也返回空消息。请帮帮我。
代码
public void connection()
{
string uriString = "http://kah601.cafe24.com/jp_mango_loadboard.php";
WebClient wc = new WebClient();
wc.Headers["Accept"] = "application/json";
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
wc.DownloadStringAsync(new Uri(uriString));
}
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
JObject o = JObject.Parse(e.Result);
String name = (string) o["name"];
String ox_score = (string) o["ox_score"];
String between_score = (string) o["between_score"];
String order_score = (string) o["order_score"];
String total_score = (string) o["total_score"];
String rank_result = name + ox_score + between_score + order_score + total_score;
MessageBox.Show(rank_result);
}