func toJSONString(dict:NSDictionary?)->String{
let data = try? NSJSONSerialization.dataWithJSONObject(dict!, options: NSJSONWritingOptions.PrettyPrinted)
let strJson = NSString(data: data!, encoding: NSUTF8StringEncoding)
return strJson! as String
}
func toJSONString(dict:NSDictionary?)->String{
let data = try? NSJSONSerialization.dataWithJSONObject(dict!, options: NSJSONWritingOptions.PrettyPrinted)
let strJson = NSString(data: data!, encoding: NSUTF8StringEncoding)
return strJson! as String
}
本文标题:swift 字典转json字符串
本文链接:https://www.haomeiwen.com/subject/hqqluttx.html
网友评论