Json 结果到 swift 中的字符串数组

Json results to a string array in swift

你好,我一直在尝试发出一个 json 请求,我想将它的一些结果放入一个字符串数组中。

所以我有以下代码

var arrRes = [[String:AnyObject]]()
var nameaRR = [String]()
override func viewDidLoad() {
    super.viewDidLoad()

    Alamofire.request(.GET, "https://graph.facebook.com/search", parameters: ["q": "", "type": "place", "center": "37.928319,23.7036673", "distance": "10000","limit": "1000", "access_token": "SomeToken", "expires_in": "5184000"])
        .responseJSON { (responseData) -> Void in
            if((responseData.result.value) != nil) {
                let swiftyJsonVar = JSON(responseData.result.value!)
                //print(swiftyJsonVar)
                if let resData = swiftyJsonVar["data"].arrayObject {
                    self.arrRes = resData as! [[String:AnyObject]]


                    self.nameaRR = swiftyJsonVar["data"]["name"] as! [String]

                    print(self.nameaRR)

                }
                if self.arrRes.count > 0 {
                    self.kati.reloadData()
                }
            }

    }


}

JSON结果如下

    {
      "data" : [
        {
          "category_list" : [
            {
              "id" : "272705352802676",
              "name" : "Outdoors"
            },
            {
              "id" : "115725465228008",
              "name" : "Region"
            }
          ],
          "id" : "552889064768971",
          "name" : "Παλαιο Φαληρο", //This String i want to put in an Array
          "category" : "Local business",
          "location" : {
            "street" : "",
            "city" : "Palaión Fáliron",
            "country" : "Greece",
            "longitude" : 23.6944070162,
            "zip" : "17562",
            "latitude" : 37.9284637008,
            "state" : ""
          }
        }
]
}

我收到警告
Cast from 'JSON' to unrelated type '[String]' always fails

但我不知道如何将所有字符串放入数组 nameaRR。 谁能帮我找到我的错误?谢谢!

看起来像那样

if let resData = swiftyJsonVar["data"] as? [[String:AnyObject]] {
  if let categorylist = resData["category_list"] as? [[String:AnyObject]]{
    if let id =  categorylist["id"] as? Int{
   print(id)
}
} 
}