I'm getting encoded data from the server, which is encoded using .NETs WebUtility.HtmlEncode.
This data is then displayed and needs to be sent back to the server for some operations. During this time, it is converted to JSON before being sent over using JSON.stringify. All works fine so far.
However, once this reaches the server, it is rejected due to being potentially dangerous. The object that is converted to JSON can have strings with special chars such as -
"This is John's account" originally "This is John's account"
Or "John earns in ¥" originally "John earns in ¥"
My belief is that these encoded string values are interfering with the JSON being properly formed.
Is there any way in Javascript that I can JSONify HTML encoded strings?
EDIT: In case it's not clear, the data is already encoded when i do JSON.stringify(data). An example of my data -
row[0] = {column1, column2, column3} Where each column is an HTML encoded string such as "This is John's account"
The solution in the end, was more of a hack, I added an annotation -
to my function on the back-end, so that it wouldn't try to validate my JSON string.