I have the following c# string that is JSON formatted.
string myString = "{color: \"red\", value: \"2\"}";
When I send this string as a response from my Controller it returns to the client with the escape characters intact.
Here is the code for my Controller I am using to return the string:
public class MyController : BaseController
{
[HttpPost]
public virtual HttpResponseMessage Post()
{
string myString = "{color: \"red\", value: \"2\"}";
HttpResponseMessage response = this.Request.CreateResponse(HttpStatusCode.OK, myString, "application/json");
return response;
}
}
My questions is: How do I return the string 'myString' to the client without the escape characters showing up on the client end?
Thank you!