的只是一个单一的节点我有一个像反序列化JSON响应
{
"appStatus":{
"status":true
},
"lastSyncDate":"06-07-2013 13.54.27",
"configResponse":{
"status":{
"status":true
},
"configs":{
"APPLOGENABLED":{
"configCode":"APPLOGENABLED",
"configDesc":"enable or disable logging from front end",
"configType":"TAB",
"configValue":"Y"
},
"COMMENTSTIMER":{
"configCode":"COMMENTSTIMER",
"configDesc":"timer for comments in seconds",
"configType":"TAB",
"configValue":"60"
},
"SUMMARYTIMER":{
"configCode":"SUMMARYTIMER",
"configDesc":"timer for summary in seconds",
"configType":"TAB",
"configValue":"30"
},
"ALERTSTIMER":{
"configCode":"ALERTSTIMER",
"configDesc":"timer for alerts in seconds",
"configType":"TAB",
"configValue":"60"
}
},
"lastSyncDate":"06/07/2013 13.48.13"
}
}
JSON响应使用json.NET,我想提取configResponse
到字典中。我知道我可以直接将Dictionary对象这样
JsonConvert.DeserializeObject<Dictionary<string,string>>()....
但由于configResponse
是一个子元素,我不能够根据需要解析它。
我想反序列化JSON以上响应,
public class ConfigResponse
{
public Status status { get; set; }
public Dictionary<string, ConfigurationItem> configs { get; set; }
public string lastSyncDate { get; set; }
}
public class ConfigurationItem
{
public String configCode { get; set; }
public String configDesc { get; set; }
public String configType { get; set; }
public String configValue { get; set; }
}
您可以添加完整的代码以便更好地理解 – rajansoft1