// MARK: 字典转字符串
func dicValueString(_dic:[String:Any]) ->String?{
letdata = try? JSONSerialization.data(withJSONObject: dic,options: [])
letstr = String(data: data!,encoding:String.Encoding.utf8)
return str
}
// MARK: 字符串转字典
func stringValueDic(_str:String) -> [String:Any]?{
letdata = str.data(using:String.Encoding.utf8)
ifletdict = try? JSONSerialization.jsonObject(with: data!,
options: .mutableContainers)as? [String:Any] {
return dict
}
return nil
}