所以我在做一个HttpWebRequest
返回 jsonstring 的方法。反序列化的字符串如下所示:
{
"have_warnings": "20",
"pp_active": false,
"noofslots": 2,
"paused": true,
"pause_int": "0",
"mbleft": 7071.03378,
"diskspace2": 55.610168,
"diskspace1": 55.610168,
"jobs": [{
"timeleft": "0:00:00",
"mb": 6918.785553,
"msgid": "",
"filename": "xxxx",
"mbleft": 5869.015694,
"id": "xx"
},
{
"timeleft": "0:00:00",
"mb": 2238.526516,
"msgid": "",
"filename": "xxxx",
"mbleft": 1202.018086,
"id": "xxxx"
}],
"speed": "0 ",
"timeleft": "0:00:00",
"mb": 9157.312069,
"state": "Paused",
"loadavg": "0.11 | 0.08 | 0.08 | V=444M R=88M",
"kbpersec": 0.0
}
现在我想在我的 UI 的标签中显示一些数据。最好的方法是什么?
我试过了:
dynamic array = JsonConvert.DeserializeObject(qstatusOutput);
foreach (var item in array)
{
MessageBox.Show("{0}{1}", item.timeleft, item.mbleft);
}
但我得到一个错误
“Newtonsoft.Json.Linq.JProperty”不包含“timeleft”的定义