I am trying to parse data form an API.
I can print the JSON list but I cannot use any data from it because it has this weird style:
(
{
name = "George George";
}
)
I am currently using this to parse the Data in Swift 3.1:
let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
if error != nil {
print(error!)
} else {
if let urlContent = data {
do {
let jsonResult = try JSONSerialization.jsonObject(with: urlContent, options: JSONSerialization.ReadingOptions.mutableContainers) as AnyObject
print(jsonResult)
print(jsonResult["name"] as AnyObject)
} catch {
print("JSON Processing Failed")
}
}
}
}
task.resume()
The print(jsonResult["name"] as AnyObject)
should return the name but it just fails
What do I need to do to parse the name?