求大神帮忙反序列化一段json
在C#里面怎么反序列化这样的json呢?
{
"answer":[
{"qsnId":"1","qsnAnswer":["1","3"]}
,{"qsnId":"2","qsnAnswer":["2","3"]}
,{"qsnId":"5","qsnAnswer":["1","3"]}
]
}
{"qsnId":"1","qsnAnswer":["1","3"]}这条数据是不固定的,有时候它会是一条,有时候它会是N条。
qsnAnswer这个属性也数据也是不固定的,有时候会是"qsnAnswer":["1"],有时候"qsnAnswer":["1","3"],有时候"qsnAnswer":["1","2","3"]
我要怎么样来写这样的反序列化类和取出数组里面的值呢?
------解决方案--------------------public class Test{
public Answer[] answer{get;set;}
public class Answer{
public int qsnId{get;set;}
public string[] qsnAnswer{get;set;}
}
}
反序列化到Test类
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/