I use WCF as server and android app as client. I have problem in parsing response in android if response contain escape characters, for example the user enters his name "mohammed \\ main center // 77132131 "
the value in database. The name of user in database as entered contain backslash and for-slash. WCF Create this response:
"[{\"name\":\" mohammed \/\/ main center \\\\\\\\ 77132131 \"}]"
I tried this in WCF server but the problem still in code
string str = JsonConvert.SerializeObject(data);
I tried replace all backslash in android but I did not getting the same value in database.
If you add a string like you said it should look like this:
"[{\"name\":\"mohammed \\\\ main center // 77132131 \"}]"
I created a WCF service for testing, if you use the proxy class to call the service, you will get the following string:
[{"name":"mohammed \\ main center // 77132131 "}]
The following code is the implementation class of the server:
public class Calculator : ICalculator
{
public string Test(string test)
{
return "[{\"name\":\"mohammed \\\\ main center // 77132131 \"}]";
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.