swift 的字典在xcode中直接打印看起来很费劲 我只想要json 原始的样子
写一个分类就ok了
下面这段直接粘贴然后 对字典和数组 po 调这个方法就Ok 了
extension Dictionary {
func jsonPrint() {
let ff =try! JSONSerialization.data(withJSONObject:self, options: [])
let str =String(data:ff, encoding: .utf8)
print(str!)
}
}
extension Array {
func jsonPrint() {
let ff =try! JSONSerialization.data(withJSONObject:self, options: [])
let str =String(data:ff, encoding: .utf8)
print(str!)
}
}