我使用C#Newtonsoft.Json来序列化和反序列化数据。 我将我的类列入了有字典,当我尝试反序列化时,我得到错误:
Error converting value "{"1":"1","3":"1"}" to type 'System.Collections.Generic.Dictionary`2[System.String,System.String]'
Json看起来像:
[{
"id": "4",
"provider": "1",
"items_id_num_json": "{\"1\":\"1\",\"3\":\"1\"}",
"creator": "",
"creation_time": "10.04.2016 19:00:25",
"deleted": "0"
}, {
"id": "3",
"provider": "1",
"items_id_num_json": "{\"1\":\"1\"}",
"creator": "",
"creation_time": "10.04.2016 18:12:01",
"deleted": "0"
}]
类别:
public class Supply
{
public string id { get; set; }
public string deleted { get; set; }
public string provider { get; set; }
public Dictionary<string, string> items_id_num_json { get; set; }
public string creator { get; set; }
public string creation_time { get; set; }
}