How do I prevent NSJSONSerialization from adding extra backslashes to my URL strings?
NSDictionary *info = @{@\"myURL\":@\"http://www.example.com/test\"};
NS
I had this issue and resolved it by instead using the now available JSONEncoder. Illustrated with code:
struct Foozy: Codable {
let issueString = "Hi \\ lol lol"
}
let foozy = Foozy()
// crashy line
//let json = try JSONSerialization.data(withJSONObject: foozy, options: [])
// working line
let json = try JSONEncoder().encode(foozy)