我有以下代码和json:
public class Labels
{
public Labels()
{}
public Label[] Label {get;set;}
}
public class Label
{
public Label()
{ }
public string Name { get; set; }
public int TorrentsInLabel { get; set; }
}
//...
Labels o = JsonConvert.DeserializeObject<Labels>(json);
//...
{"label":
[
["seq1",1]
,["seq2",2]
]}
我希望这个数组 ["seq1","1"] 反序列化为 Label 对象。我错过了什么?一些属性?
当我运行时出现异常:预期类型为“test_JSONNET.Label”的 JsonArrayContract,得到了“Newtonsoft.Json.Serialization.JsonObjectContract”。
tnx
gg