我收到错误解析远程JSON
数组,如何解决这个问题?
类型'Any'没有下标成员
代码
do {
if let json = response.result.value {
//print("Server JSON Response : \(json)")
if let countries = json["Countries"] as? [String: Any] {
for country in countries {
if let couname = country["countryname"] as? [AnyObject] {
country_names.append(couname)
}
if let coucode = country["code"] as? [AnyObject] {
country_codes.append(coucode)
}
}
}
}
} catch let parseError {
print("Hioston we have problem \(parseError) ")
}
答案 0 :(得分:0)
Typecast回复:
if let json = response.result.value as? [String:AnyObject]{..}