我希望能够从JSON数组中获取一些数据:here 所以下面,我试图显示EARLIEST> DATE
func parseJSONtowns() {
let url = NSURL(string: "https://api.tfl.gov.uk/journey/journeyresults/\(selectedStation)/to/\(selectedStation1)")
let jsonData = NSData(contentsOfURL: url!)
let readableJSON = try! NSJSONSerialization.JSONObjectWithData(jsonData!, options: []) as! [String:AnyObject]
let object = JSON(readableJSON)
let searchCriteria = object["earliest"]
for option in searchCriteria.arrayValue {
let commonName = option["date"].stringValue
commonNameArray.append(commonName)
}
selectedStation = selectedStation.stringByReplacingOccurrencesOfString("%20", withString: " ")
NumberOfRows = commonNameArray.count
NSLog("\(url)")
NSLog("number of rows: \(NumberOfRows)")
}
答案 0 :(得分:1)
date
的{{1}}位于字典earliest
的字典timeAdjustments
中
searchCriteria