I am receiving data from a web service, and some of the strings have html entities in them, for example:
{"prop": "htmlentity - é"}
The é is not being parsed to é.
My question is twofold:
- Is this even supposed to happen?
I looked through the JSON spec the best I could, but couldn’t find any reference to html entities. - What is the right way to do this with a
DataContractJsonSerializer?, if there is a right way?
You can call HttpUtility.HtmlDecode on the strings that contain HTML entities.
This is not the job of DataContractJsonSerializer, as the JSON spec only requires quotation mark, reverse solidus, and the control characters to be escaped.