【发布时间】:2017-07-15 22:27:58
【问题描述】:
我有从另一个应用程序返回的 json 对象,我无法控制它并且每个对象的结构不同,但我想从每个对象中提取相同的数据及其标题(我正在使用 NewtownSoft):
{
"myData": [
{
"one": {
"in": 0,
"out": 17,
"total": 17
},
"two": {
"total": 17
},
"three": {
"total": 0
},
"four": {
"total": 8
},
"five": {
"total": 0
},
"six": {
"total": 0
},
"seven": {
"total": 0
}
} ]}
我希望结果和这张图片一样
并仅使用一个类反序列化此代码
public class Example{
public string number {get;set;}
public int total {get; set;}
}
【问题讨论】:
标签: c# json json-deserialization