我在ASP.Net中工作,JsonConvert不起作用。如何使用JsonConvert?
我已经下载了NewtonSoft,并将该字符串(使用Newtonsoft;)写入到我的项目中。
public void FillDataGrid()
{
DataTable dt = new DataTable();
string json;
string url = "http://192.168.0.111:2903/MigraPlus.asmx/GetDataJson";
using (WebClient client = new WebClient())
{
json = client.DownloadString(url);
}
string[] json1 = json.Split('>');
string[] json2 = json1[2].Split('<');
json = json2[0];
dt = (DataTable)JsonConvert.DeserializeObject(json, typeof(DataTable));
GridView1.DataSource = dt;
GridView1.DataBind();
}