title: How can I apply HTML decoding in an Azure API Management (C#) policy expression?
body: <p>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 <a href="https://feedback.azure.com/forums/248703-api-management/suggestions/19043419-support-urlencoding-for-the-c-implementation" rel="nofollow noreferrer">- also see feedback forum</a>?</p>
  
  <p>Trying to use a self-made version fails, because policy editor translates <code>&amp;auml;</code> to <code>ä</code>: </p>
  
  <pre><code>&lt;set-body&gt;@{
      string HtmlDecode(string input) =&gt; input.Replace("&amp;auml;","ä");
      var body = context.Request.Body.As&lt;JObject&gt;(true);
      body["field1"] = HtmlDecode(body["field1"].ToString());
      return body.ToString();
  }&lt;/set-body&gt;
  </code></pre>