我有以下代码和JSON:JSON.net问题JsonConvert.DeserializeObject
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
你试过“反映了”吗? – 2009-10-12 10:32:18
JSON.net是开源的,我现在正在通过代码,但没有到目前为止。 – 2009-10-12 10:33:35
建议:在开始查看源代码之前,如何查看一些文档? (http://james.newtonking.com/projects/json/help/) – Svish 2009-10-12 10:54:46