阿拉莫菲尔 Swift Json

Alamofire Swift Json

我通过这种方法接收 Instagram JSON

Alamofire.request("https://www.instagram.com/", method: .get, encoding: JSONEncoding.default)
    .responseJSON { response in
        debugPrint(response)

        if let data = response.result.value{

            if  (data as? [[String : AnyObject]]) != nil{

                if let dictionaryArray = data as? Array<Dictionary<String, AnyObject?>> {
                    if dictionaryArray.count > 0 {

                        for i in 0..<dictionaryArray.count{

                            let Object = dictionaryArray[i]
                            if let dUrl = Object["display_url"] as? String{
                                print("Find: \(dUrl)")
                            }
                            if let id = Object["id"] as? String{
                                print("User Id: \(id)")
                            }
                        }
                    }
                }
            }
        }
        else {
            let error = (response.result.value  as? [[String : AnyObject]])
            print(error as Any)
        }
}

但是请帮助我。我怎样才能收到: - ID 和 - display_resources[2]

中的第三个 link

SwiftyJSON 文档非常详细: https://github.com/SwiftyJSON/SwiftyJSON

let json = JSON(response.result.value ?? [])
let id = json["shortcode_media"]["id"].stringValue
let url = json["shortcode_media"]["display_url"]["display_resources"][2]["src"].stringValue