I have payload in a HTTP POST body where I need to apply HTML decoding on specific fields before forwarding to the backend. How can I achieve this in API Management policy expressions where System.Web.HttpUtility.HtmlDecode seems not to be available - also see feedback forum?
Trying to use a self-made version fails, because policy editor translates ä to ä:
<set-body>@{ string HtmlDecode(string input) => input.Replace("ä","ä"); var body = context.Request.Body.As<JObject>(true); body["field1"] = HtmlDecode(body["field1"].ToString()); return body.ToString(); }</set-body>
System.Net.WebUtilitynamespace? stackoverflow.com/questions/35437491/….Replace("\u0026auml;","ä")but you are going to have to do a lot of find/replace.