0
的名單我有一個看起來像這樣的JSON數據:地圖屬性對象
{
"Item1": {
"Field1": "Val1",
"Field2": "Val2"
},
"Item2": {
"Field1": "Val11",
"Field2": "Val22"
}
}
我需要將其反序列化到了一組類,如下所示:
public class Root
{
public List<Item> Items; // << Item1 and Item2 should go here
}
public class Item
{
public string Field1;
public string Field2;
}
如何我可以使Newtonsoft.Json在反序列化時以這種方式映射數據嗎?
你的json應該組成一個數組才能工作。 –