我已经尝试了几乎所有我能想到的尝试使用 JSON.net 库解析这个 JSON 字符串,但我不断收到一个错误,上面写着“字符串反序列化后的附加文本”。有人对可能出现的问题有任何想法吗?
这是我拥有的 JSON 字符串:
{"w_vendor":["914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361","914115361"]}
这是我用来尝试解析它的代码:
var pdfValue = Request["pdfValue"];
string OutputCacheLocation = JsonConvert.SerializeObject(pdfValue);
DataSet dataset = JsonConvert.DeserializeObject<DataSet>(pdfValue);
DataTable datatable = dataset.Tables["table1"];
Response.Write(datatable.Rows.Count);
有没有人看到错误所指的附加文本?我看不到它,而且 JSON 不会解析。我准备放弃并自己手动解析它。