Convert Dictionary to string in swift4 iOS
Solution:
do {
let theJSONData = try JSONSerialization.data(
withJSONObject: dic ,
options: JSONSerialization.WritingOptions(rawValue: 0))
let theJSONText = NSString(data: theJSONData,
encoding: String.Encoding.ascii.rawValue)
let str = String(describing: theJSONText)
} catch let error as NSError {
// handle error
}
Comments
Post a Comment