tinode / ios

Tinodios: Tinode Messaging Client for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON serializer adds unnecessary backslashes

or-else opened this issue · comments

commented

The currently used JSON serializer adds backslashes for forward slashes, i.e. string "abc/def" becomes "abc\/def".

This seems to have been a long-standing issue:
https://stackoverflow.com/questions/47076329/swift-string-escaping-when-serializing-to-json-using-codable

We'll perhaps have to use string replacement as a workaround for now.

commented

I just checked: js and go parse such strings correctly:

var z = '{"x": "http:\/\/www.example.com\/"}';
console.log(JSON.parse(z));

Result:

{x: "http://www.example.com/"}

Go:
https://play.golang.org/p/0quh2bzP4hL

I'll check in Java and if it parses it correctly too then it's not a problem at all.

commented

I just checked it on Android. It handles such json without any problems. We don't need to do anything. Closing.