【发布时间】:2013-07-11 13:21:38
【问题描述】:
早安,
我正在解析 JSON 响应。假设我有这个 JSON:
{
"data": {
"count" : 3,
"innerData" : [
{
"dataInfo" : "heheh",
"dataInfo2" : "hahah",
"dataInfo3" : "huhuh"
},
{
"dataInfo" : "jejej",
"dataInfo2" : "jajaj",
"dataInfo3" : "jujuj"
},
{
"dataInfo" : "fefef",
"dataInfo2" : "fafaf",
"dataInfo3" : "fufuf"
}
]
}
}
好的。那么如果我只想显示像“dataInfo”这样的数据怎么办..在Python中,我可以很容易地做到这一点:
for x in response.json()['data']['innerData']
print(x['dataInfo'])
这会显示这个:
>>> heheh
>>> jejej
>>> fefef
如何在 C# 中做到这一点?我试过这个:http://procbits.com/2011/08/11/fridaythe13th-the-best-json-parser-for-silverlight-and-net
但这仅适用于非数组 JSON..
希望有人可以指导我,
【问题讨论】:
标签: c# json python-3.x json-deserialization