I have the following json output. How to parse json in swift so that I can display it in table view?
[{"firstName":"faisal","address":"Apartemen Casa Grande 0708"}]
Try this code i hope help you
var parseError: NSError?
let parsedObject: AnyObject? = NSJSONSerialization.JSONObjectWithData(data,
options: NSJSONReadingOptions.AllowFragments,
error:&parseError)
//2
if let topApps = parsedObject as? NSArray
{
if let feed = topApps["firstName"] as? NSDictionary
{
if let feed = topApps["address"] as? NSDictionary
{
println("Optional Binding: \(appName)")
}
}
}