我有一个与此类似的大型 JSON 文件:
{
"data":[
{
"attribution":null,
"tags":[
"thenight2"
],
"type":"image",
"images":{
"standard_resolution":{
"url":"http://distilleryimage3.s3.amazonaws.com/59d6984092a211e392db12e25f465f4f_8.jpg",
"width":640,
"height":640
}
}
},
{
"attribution":null,
"tags":[
"thenight2"
],
"type":"image",
"images":{
"low_resolution":{
"url":"http://distilleryimage1.s3.amazonaws.com/c179b34a91ff11e3b99c0aa73e1070c5_6.jpg",
"width":306,
"height":306
},
"thumbnail":{
"url":"http://distilleryimage1.s3.amazonaws.com/c179b34a91ff11e3b99c0aa73e1070c5_5.jpg",
"width":150,
"height":150
},
"standard_resolution":{
"url":"http://distilleryimage1.s3.amazonaws.com/c179b34a91ff11e3b99c0aa73e1070c5_8.jpg",
"width":640,
"height":640
}
},
"users_in_photo":[
]
}
]
}
我想从所有的列表中提取url
属性值来自standard_resolution
JSON 中所有图像的属性。如何做呢?
我之前在 System.Web.Helpers 命名空间 (.Net 4.0) 中使用过 JSON 类,它对我来说效果很好。您可以动态引用数组。它的使用方式应该与此类似:
dynamic myJson = Json.Decode(myJsonString);
foreach (var url in myJson.data.images.standard_resolution){
//DO SOMETHING
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)