解析api的json
//方式一: 获取JSON:格式为: [{"ID":"aaaa","NO":"111","NAME":"111","DESC":"1111"},{"ID":"bbbb","NO":"222","NAME":"222","DESC":"2222"}]
//解析json public ActionResult About() { string url = "http://192.168.0.123/api/apimv/GetOrder"; var by = new WebClient().DownloadData(url); // 调用接口 var result2 = System.Text.Encoding.UTF8.GetString(by); List<ORDER> list = JsonConvert.DeserializeObject<List<ORDER>>(result2);//需要先建立对应model return View(); }
方式二: