[英]Parse JSON with Swift JSON
How to get Value Radio Name With Swift JSON如何使用 Swift JSON 获取值单选名称
I wrote like this我是这样写的
let response = JSON["topradio"]["Data"]
before this i created model for values but am not able to pic values like radio_name在此之前,我为值创建了模型,但不能像 radio_name 这样的值
{
"topradio": {
"result": "success",
"Data": [
[
{
"radio_name": "Kantipur",
"rimage": "radio/1422960479145155755920731096211441695162.jpeg",
"status": "1",
"user_faverate": "false",
"popular_radio": "0",
"radio_id": "4"
}
]
[
{
"radio_name": "Kantipur",
"rimage": "radio/1422960479145155755920731096211441695162.jpeg",
"status": "1",
"user_faverate": "false",
"popular_radio": "0",
"radio_id": "4"
}
]
]
}
Thanks in Advance提前致谢
You can iterate through your nested data
Array this way.您可以通过这种方式遍历嵌套data
数组。
let dataArray = JSON["topradio"]["Data"].array
for item in dataArray {
let itemArray = item.array
for subItem in itemArray {
if let name = subItem["radio_name"].string {
print(name)
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.