[问题] swifty搭配alamofire取json问题

楼主: ted66 (ted)   2017-04-15 07:08:23
目前使用SwiftyJSON搭配Alamofire
我用print(json)会取得
{
"error" : "0",
"addresses" : "[{\"address\":\"????????15?\",\"latitude\":23.003111,\"longitude\":120.17398,\"createdTime\":\"Apr 8, 2017 12:00:00 AM\",\"id\":3}, {\"address\":\"?????????????\",\"latitude\":23.003111,\"longitude\":120.17398,\"createdTime\":\"Apr 8, 2017 12:00:00 AM\",\"id\":4}]"
}
再用print(json["addresses"])会取得
[{"address":"????????15?","latitude":23.003111,"longitude":120.17398,"createdTime":"Apr 8, 2017 12:00:00 AM","id":3}, {"address":"?????????????","latitude":23.003111,"longitude":120.17398,"createdTime":"Apr 8, 2017 12:00:00 AM","id":4}]
到这都没问题,但是再来怎么取都取不出来arrary里面的东西
可以请问一下该怎么写比较好呢
作者: uranusjr (←這人是超級笨蛋)   2017-04-15 09:17:00
address 不是 array, 是一个 JSON array 的字串
作者: czh0305 (Hsiu)   2017-04-17 18:29:00
json["addresses"][0]
作者: ggzxc (打脚大将军)   2017-04-18 23:23:00
json["addresses"].array
楼主: ted66 (ted)   2017-04-24 20:44:00
感谢喔

Links booklink

Contact Us: admin [ a t ] ucptt.com