我正在尝试解析这样的json,其中使用了许多数组和对象如何解析它。
[
{
"MusicData": [
{
"user_music_id": "199",
"music_id": "2",
"music_name": "Country"
},
{
"user_music_id": "200",
"music_id": "2",
"music_name": "Country"
}
]
},
{
"SportData": [
{
"user_sport_id": "179",
"sport_id": "4",
"sport_name": "Hockey"
}
]
},
{
"HobbyData": []
},
{
"RelationData": []
},
{
"MovieData": [
{
"user_movie_id": "144",
"movie_id": "6",
"movie_name": "Drama"
}
]
},
{
"BookData": []
},
{
"CarrerData": [
{
"user_carrer_id": "186",
"carrer_id": "7",
"carrer_name": "Marketing"
},
{
"user_carrer_id": "187",
"carrer_id": "8",
"carrer_name": "Sales"
}
]
}
]
MyMusic 是一个字典,它有一个包含许多索引的数组。
如何一一解析其数据?使用标签 MyMusic、SportData 等。
我正在尝试使用以下代码从此 json 解析 CarrerData:
musicTemp._id = [NSString stringWithFormat:@"%@",[[[responseDict objectAtIndex:0] valueForKey:@"MusicData"] valueForKey:@"user_music_id"]];