Hi
I've a little question about decoding special characters from a JSon result (in my case, \x27 but it could be any valid html encoded character). If the result doesn't contains any escaped characters, it works well but if not, I get a Unrecognized escape sequence exception. I try to do an HttpUtility.HtmlDecode on the Json string before deserializing using JavascriptSerializer, it doesn't work, the character still in encoded format.
Here's a code snippet :
public IEnumerable<QuoteInfo> ParseJson(string json)
{
System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
List<QuoteInfo> result = jss.Deserialize<List<QuoteInfo>>(System.Web.HttpUtility.HtmlDecode(json));
return result;
}
I tried to use RegistersConverters to HtmlDecode any string I could find during deserialization but I can't figure out how to use it properly.
How can I solve that problem ?
Thanks.
UPDATE
As back2dos nicely explained, this problem wasn't related to an HtmlDecode problem but to an misformatted Json string. Thanks all for your help.