我想在C#中反序列化一个JSON文件,因此每个订单都在一个单独的行上,所有值都可以。我对反序列化JSON没有问题,但是这个具有可变属性名称。例如,下面的文件有2个顺序:O1ZBIX-GGYTG-RJVXNK& ORJZUB-AL7JW-7BBWPZ。请告诉我如何做到这一点。
{
"error": [],
"result": {
"open": {
"O1ZBIX-GGYTG-RJVXNK": {
"refid": null,
"userref": null,
"status": "open",
"opentm": 1486584202.2485,
"starttm": 0,
"expiretm": 0,
"descr": {
"pair": "XBTEUR",
"type": "sell",
"ordertype": "limit",
"price": "1019.000",
"price2": "0",
"leverage": "none",
"order": "sell 0.20809000 XBTEUR @ limit 1019.000"
},
"vol": "0.20809000",
"vol_exec": "0.00000000",
"cost": "0.00000",
"fee": "0.00000",
"price": "0.00000",
"misc": "",
"oflags": "fciq"
},
"ORJZUB-AL7JW-7BBWPZ": {
"refid": null,
"userref": null,
"status": "open",
"opentm": 1486468345.44,
"starttm": 0,
"expiretm": 0,
"descr": {
"pair": "LTCEUR",
"type": "sell",
"ordertype": "limit",
"price": "3.78000",
"price2": "0",
"leverage": "none",
"order": "sell 54.20054000 LTCEUR @ limit 3.78000"
},
"vol": "54.20054000",
"vol_exec": "0.00000000",
"cost": "0.00000",
"fee": "0.00000",
"price": "0.00000",
"misc": "",
"oflags": "fciq"
}
}
}
}
答案 0 :(得分:1)
从http://www.newtonsoft.com/json
安装最新版本的Json.Net然后使用JObject o = JObject.Parse(json);