快速访问JSON响应数组中的数组?

问题描述

我正在尝试访问数组中的数组响应,这就是我成功获取friends数组的方式

let url = URL(string: "http://xyz/api/get-friends-in-meetings")

AF.request(url!,method: .get,parameters: nil,encoding: JSONEncoding.default,headers: headers).responseJSON{ response in
    switch response.result {
    case .success:
        let responseValue = response.value as! NSDictionary
        let friends: [NSDictionary] = responseValue["friends"] as! [NSDictionary]
        //here I want to store the "meeting array so that I can use it later"
        break
    case .failure(let error):
        print(error)
        break
    }
}

这是JSON响应

{
    "status": 0,"message": "Friends found.","friends": [
        {
            "id": 24,"name": "XYZ","email": "[email protected]","meetings": [
                {
                    
                    "meeting_with": "X","meeting_person_screen_name": "Y","meeting_purpose": "Z",}
            ]
        }
    ]
}

如何获取“朋友”数组中的“会议”数组?我尝试过和朋友一样的尝试,但是显示错误下标调用中没有完全匹配

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)