Let's say I submit a service request and receive the following JSON response:
{
"message": "We're unable to complete your request at this time."
}
All I know is that I want to decode that apostrophe; I have no idea why it is encoded that way ('').
Here is a jQuery-based method that sprang to mind:
function decodeHtml(html) {
return $('<div>').html(html).text();
}
But that looks (very) clumsy. What might work better? Exists a "correct" approach?