Note. I assume that you have only part of the data, and not the entire JSON fragment - for example,
string s = @"blah \u003c blah \u00252 blah";
If the above assumption is incorrect and you have a full JSON snippet, just use the JavaScriptSerializer to get the object from the data.
Annoyingly, HttpUtility is encoded but not decoded.
You can spoof a string into a full JSON object, although this seems a bit crowded:
class Dummy { public string foo { get; set; } } static void Main(string[] args) { string s = @"blah \u003c blah \u00252 blah"; string json = @"{""foo"":""" + s + @"""}"; string unencoded = new JavaScriptSerializer().Deserialize<Dummy>(json).foo; }
source share