I am trying to access the JSON that I get via Alamofire:
func getDataFromServer() {
Alamofire.request(.POST, websiteURL, parameters: myParameters) .responseString {
(response) -> Void in
if let value = response.result.value {
let json = JSON(value)
self.parseJSON(json)
}
}
}
,and the JSON that is being returned to me looks something like this:
{
"status":"success",
"object":[
{
"name":"Bob",
"age":"20 ",
},
{
"name": "Jane",
"age":"25"
},
]
}
and I am using SwiftyJSON to access the names:
func parseJSON(json: JSON) {
for result in json["object"].arrayValue {
print(result["name"].stringValue)
}
}
but it is not printing anything. Am I doing something wrong?