HandyJSON icon indicating copy to clipboard operation
HandyJSON copied to clipboard

这个字符串为什么解析不出来呢

Open LYluyu opened this issue 2 years ago • 2 comments

这个字符串为什么解析不出来呢

class Attachment: NSObject { var type : String? var subType : String? var data: [String:Any]?

}

{"type":"SYSTEM","subType":"SYSTEM_TITLE_URL","data":"{\"title\":\"View notification\",\"msg\":\"User100833 ID(100833) viewed your profile, drop a line to see if User100833 needs help.Get $0.1 if you reply to your customer within 1 minute\",\"url\":\"star://message/messageDetail?businessId=211215095623664950135157010094\",\"appAlertFlag\":true}"}

LYluyu avatar Dec 15 '21 03:12 LYluyu

#iOS 15 NumberFormatter number 转 string 丢失精度问题 find_and_replace("Pods/HandyJSON/Source/BuiltInBasicType.swift", "formatter.maximumFractionDigits = 16", "formatter.maximumFractionDigits = 10")

viihua avatar Jun 02 '22 14:06 viihua

这个在 JSON 解析这里就失败了, "data":"{\"title... , 可以看出来 data 字段的内容也是一个 JSON 字符串, 这种嵌套就需要转义, 看起来 " 已经转义了, 但实际上 \ 也是需要转义的, 正确的格式应该是 "data":"{\\"title...

ThickFive avatar Mar 16 '23 06:03 ThickFive