我想將JSON文本序列化爲DataTable,如下所示。JSON到DataTable
List<Dictionary<string, string>> list =
JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(jsonText);
DataTable dTable;
dTable = (from p in list select p).CopyToDataTable();
我收到以下錯誤消息。我如何解決它?
錯誤:
Cannot deserialize JSON object into type
'System.Collections.Generic.List`1[System.Collections.Generic.Dictionary`2
[System.String,System.String]]'.
這似乎相當明顯,我認爲這無關與數據表,作爲異常被拋出在第一行。這就是你應該關注的。 – 2011-04-14 07:10:28
請檢查這裏的答案 http://stackoverflow.com/a/35546685/5292650 它最簡單的一個 – 2016-02-22 06:14:27