riseres riseres - 1 year ago 112
JSON Question

Return Json, but it includes backward slashes "\", which i don't want

I use MVC4 web-api, c#, and want to return Json uning Json.net.

the problem is it comes with "backward slashes".

I also added this code to Global.asax.


here is what it returns.


so what i want to see is


here is JsonConvetor

string json = JsonConvert.SerializeObject(myObj);

Answer Source

i found the solution here it is

return new HttpResponseMessage()
            Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download