I am currently working on an app which brings back json, in the following format
\"location_subtype\" = \"somevalue\"; \"location_type\" = Force;
Try something like this:
Swift code:
if let outcome = dict["outcome_status"] as? NSDictionary {
//Now you know that you received a dictionary(another json doc) and is not 'nil'
//'outcome' is only valid inside this if statement
if let category = outcome["category"] as? String {
//Here you received string 'category'
outcomeStatusLabel.text = category
outcomeStatusLabel.font = UIFont.systemFontOfSize(14.0)
outcomeStatusLabel.numberOfLines = 0
}
if let date = outcome["date"] as? String {
//Here you received string 'date'
outcomeDateLabel.text = date
outcomeDateLabel.font = UIFont.systemFontOfSize(14.0)
outcomeDateLabel.numberOfLines = 0
}
}
This is a safe way to work with Json.