0
我從zoho獲得json。我有這樣一個JSON如下:Json反序列化沒有結果
{
"response": {
"result": {
"Leads": {
"row": [
{
"no": "1",
"FL": [
{
"content": "1325469000000679001",
"val": "LEADID"
},
{
"content": "1325469000000075001",
"val": "SMOWNERID"
},
{
"content": "Geoff",
"val": "Lead Owner"
},
]
},
{
"no": "2",
"FL": [
{
"content": "1325469000000659017",
"val": "LEADID"
},
{
"content": "1325469000000075001",
"val": "SMOWNERID"
},
{
"content": "Geoff",
"val": "Lead Owner"
},
]
},
]
}
},
"uri": "/crm/private/json/Leads/getRecords"
}
}
我使用以下類:
public class Row
{
[JsonProperty(PropertyName = "row")]
public List<Leads> row { get; set; }
}
public class Leads
{
[JsonProperty(PropertyName = "no")]
public string nbr { get; set; }
[JsonProperty(PropertyName = "FL")]
public List<Lead> FieldValues { get; set; }
}
public class Lead
{
[JsonProperty(PropertyName = "content")]
public string Content { get; set; }
[JsonProperty(PropertyName = "val")]
public string Val { get; set; }
}
我嘗試反序列化JSON,並取回什麼:
var mList = JsonConvert.DeserializeObject<IDictionary<string, Row>>(result);
這是第一次與Json合作,所以任何幫助將不勝感激!
http://www.newtonsoft.com/json/help/html/SerializationAttributes.htm – 2015-04-02 20:26:15
使用剪貼板上的JSON字符串,您可以執行**編輯 - >選擇性粘貼 - >粘貼JSON作爲類**和VS會爲你創建JSON的類 – Plutonix 2015-04-02 20:42:56