1

In my Xamarin.Android project, I'm using NewtonSoft Serialization to serialize my Object into JSON string. But when I do this my string has escape characters like this:

{\"id\":\"45912345\",\"number\":\"c6474a2345\"}

But I want like this:

{"id":"45912345","number":"c6474a2345"}

I tried to replace the \ character by:

var data = "{\"id\":\"45912345\",\"number\":\"c6474a2345\"}";
data = data.Replace(@"\","");

but nothing happens. As this is an escape character, this is not printed on console, but I need to send this as form data to my Rest API.

How do I get a valid JSON string?

pratiti-systematix
  • 792
  • 11
  • 28

0 Answers0