title: Escape and remove characters (dynamic content) in a logic app
body: <p>I've been trying to fetch data from a REST API and then add it into Log Analytics in Azure using a Logic app. My issue is that it seems that I need to escape some characters in the body of the request to Log Analytics since I get a 400 with the error message:</p>
  <blockquote>
  <p>{
  &quot;Error&quot;: &quot;InvalidDataFormat&quot;,
  &quot;Message&quot;: null
  }</p>
  </blockquote>
  <p>I've checked and the JSON body is not valid.</p>
  <p>My JSON request body looks like this:</p>
  <pre><code>{
  &quot;assetid&quot;: &quot;TBD Assetid&quot;,
  &quot;vulnid&quot;: &quot;@{items('For_each')?['id']}&quot;,
  &quot;key&quot;: &quot;@{items('For_each_3')?['key']}&quot;,
  &quot;proof&quot;: &quot;@{items('For_each_3')?['proof']}&quot;,
  &quot;since&quot;: &quot;@{items('For_each_3')?['since']}&quot;,
  &quot;status&quot;: &quot;@{items('For_each_3')?['status']}
  }
  </code></pre>
  <p>The actual request looks like this:</p>
  <pre><code>{
  &quot;assetid&quot;: &quot;TBD&quot;,
  &quot;vulnid&quot;: &quot;adobe-flash-apsb15-11-cve-2015-3096&quot;,
  &quot;key&quot;: &quot;C:\WINDOWS\system32\Macromed\Flash\&quot;,
  &quot;proof&quot;: &quot;&lt;p&gt;&lt;p&gt;Vulnerable OS: Microsoft Windows Server 2012 R2 Datacenter Edition&lt;p&gt;&lt;/p&gt;&lt;/p&gt;&lt;p&gt;Vulnerable software installed: Adobe Flash 17.0.0.188 (C:\WINDOWS\system32\Macromed\Flash\)&lt;/p&gt;&lt;/p&gt;&quot;,
  &quot;since&quot;: &quot;2021-05-10T11:41:03.483Z&quot;,
  &quot;status&quot;: &quot;vulnerable-version&quot;
  }
  </code></pre>
  <p>The issue seems to be the backslashes and the paragraphs elements.</p>
  <p>I would like to escape the backslashes in &quot;key&quot; and &quot;proof&quot; and remove the paragraphs element. I've tried to search for a solution but most of the examples are with static strings and the replace function.</p>
  <p>Any ideas?</p>