I have a c# method that calls another method which returns back a string that is supposed to represent JSON. However, the string has escape characters in it:
public string GetPerson()
{
string person = repo.GetPerson(); //person is {name:jack,age:54...
return person;
}
If I try to do a replace, there is no change:
string person = repo.GetPerson().Replace(@, ); //person still has escape characters
When I try to view person in the text viewer when debugging, the escape characters are not there--Visual Studio rips them off. But my javascript that calls this method does see the escape characters in the ajax response.
If I try to deserialize the person string into my C# User object, it does not deserialize properly:
User user = JsonConvert.DeserializeObject<User>(person);
What are my options? How can I either strip off the escape characters from the person string, or deserialize it correctly to the User object?