let array = [ "one", "two" ]
func notPrettyString(from object: Any) -> String? {
if let objectData = try? JSONSerialization.data(withJSONObject: object, options: JSONSerialization.WritingOptions(rawValue: 0)) {
let objectString = String(data: objectData, encoding: .utf8)
return objectString
}
return nil
}
网友评论