Convert Dictionary to JSON in Swift
Swift 3.0 With Swift 3, the name of NSJSONSerialization and its methods have changed, according to the Swift API Design Guidelines. let dic = [“2”: “B”, “1”: “A”, “3”: “C”] do { let jsonData = try JSONSerialization.data(withJSONObject: dic, options: .prettyPrinted) // here “jsonData” is the dictionary encoded in JSON data let decoded = try JSONSerialization.jsonObject(with: … Read more