# Escape characters added when submitting synthetic HTTP POST call with json request body

**URL:** <https://community.dynatrace.com/t/escape-characters-added-when-submitting-synthetic-http-post-call-with-json-request-body/46447>\
**Category:** Synthetic Monitoring\
**Tags:** json, http-monitor, synthetic-monitoring\
**Created:** [July 3, 2024, 3:07pm UTC](https://community.dynatrace.com/t/escape-characters-added-when-submitting-synthetic-http-post-call-with-json-request-body/46447 "2024-07-03T15:07:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harvey](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@Harvey](https://community.dynatrace.com/u/Harvey)\
**Post date:** [July 3, 2024, 3:07pm UTC](https://community.dynatrace.com/t/escape-characters-added-when-submitting-synthetic-http-post-call-with-json-request-body/46447/1 "2024-07-03T15:07:43Z")

</div>

I’ve created a HTTP POST synthetic call to an application that uses json payloads for the requests. When entering the request body with valid json, I can see in the subsequent calls that Dynatrace is adding in escape characters for the double quotes in the json, i.e. ‘\"’. The application is reading this rejects the request as the json is not well formed. I’ve separately testing the json request payload successfully.

Looking at the request body in script mode it looks like the script is itself json with the requestBody field attempting to add the request payload using the escaped double quotes. Is there a means of using a json request payload with a HTTP synthetic call without corrupting the json? Or possibly a means of adding the json payload into the prerequest script and calling it as a json object in the requestBody to avoid the escape characters?

---

<div class="post-metadata">

**Author:** ![hannahmac](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [July 4, 2024, 8:00am UTC](https://community.dynatrace.com/t/escape-characters-added-when-submitting-synthetic-http-post-call-with-json-request-body/46447/2 "2024-07-04T08:00:13Z")

</div>

You can manipulate and set the request body in pre-request scripts using

```markup
request.setBody(requestBody)

```

using&nbsp;[Pre- and post-execution scripts for HTTP monitors in Classic — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/http-monitor-pre-post-script#pre-execution)

---

<div class="post-metadata">

**Author:** ![Harvey](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@Harvey](https://community.dynatrace.com/u/Harvey)\
**Post date:** [July 4, 2024, 9:20am UTC](https://community.dynatrace.com/t/escape-characters-added-when-submitting-synthetic-http-post-call-with-json-request-body/46447/3 "2024-07-04T09:20:28Z")

</div>

Thanks for getting back to me. I’ve tried adding the below to the pre request script.

var json = ‘{jsonArray}’;  
request.setBody(json);

Dynatrace is still adding in the escape characters to the requestBody json though which is breaking it when it reaches the application due to the backslashes.

Is there any other means of submitting requestBody json or disabling the backslashes that are being added?

---

<div class="post-metadata">

**Author:** ![hannahmac](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [July 4, 2024, 1:28pm UTC](https://community.dynatrace.com/t/escape-characters-added-when-submitting-synthetic-http-post-call-with-json-request-body/46447/4 "2024-07-04T13:28:37Z")

</div>

Can you open an in-product chat to look at this?
