# How to send value which contains backward slash, dynamically in postman request body?

**URL:** <https://community.postman.com/t/how-to-send-value-which-contains-backward-slash-dynamically-in-postman-request-body/12221>\
**Category:** Help Hub\
**Tags:** json, request, request-payload\
**Created:** [April 27, 2020, 7:44am UTC](https://community.postman.com/t/how-to-send-value-which-contains-backward-slash-dynamically-in-postman-request-body/12221 "2020-04-27T07:44:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prachii](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@Prachii](https://community.postman.com/u/Prachii)\
**Post date:** [April 27, 2020, 7:44am UTC](https://community.postman.com/t/how-to-send-value-which-contains-backward-slash-dynamically-in-postman-request-body/12221/1 "2020-04-27T07:44:10Z")

</div>

I am using Postman for testing POST API. Purpose of API : The API should download some data at given “path”.

**Case : 1** When I give hard-coded path in request body-

```auto
{
    "downloadPath": "D:\\folderName",
    "objectID": "1234"
}

```

I get expected response in this case.

**Case : 2** I want to send this path and ID dynamically. Now the Request Body looks like-

```auto
{
    "downloadPath": "{{path}}",
    "objectID": "{{id}}"
}

```

It reads the values from JSON file which looks like-

```auto
[
{
    "path":"D:\\folderName1",
    "id":"1234"
},
{
    "path":"D:\\folderName2",
    "id":"5678"
}
]

```

It does not give expected response.

**Note:** Is it something related to backward slash present in the path? Because, when I give hard-coded path and then give only object ID dynamically through JSON file, it works.

What could be the reason?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 27, 2020, 11:33am UTC](https://community.postman.com/t/how-to-send-value-which-contains-backward-slash-dynamically-in-postman-request-body/12221/2 "2020-04-27T11:33:57Z")

</div>

Hey @Prachii,

Have you tried escaping those backslashes in the data file like this?

```
[
    {
        "path":"D:\\\\folderName1",
        "id":"1234"
    },
    {
        "path":"D:\\\\folderName2",
        "id":"5678"
    }
] 

```

 ![Screenshot 2020-04-27 at 12.33.00](https://us1.discourse-cdn.com/getpostman/original/2X/b/b66e200c42c2320e1ab9685016b83f44ee794a88.png)

---

<div class="post-metadata">

**Author:** ![Prachii](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@Prachii](https://community.postman.com/u/Prachii)\
**Post date:** [April 27, 2020, 4:47pm UTC](https://community.postman.com/t/how-to-send-value-which-contains-backward-slash-dynamically-in-postman-request-body/12221/3 "2020-04-27T16:47:33Z")

</div>

Hi @dannydainton ,

I tried 4 backslashes in the data file, but it gives only one at postman console and responds with the same error.

Postman console looks like

![image](https://us1.discourse-cdn.com/getpostman/original/3X/a/6/a6cc4efaa3903e6a6d0f4dfa3aa68ec391885e2f.png)

But I think this should not be an issue because, When I give file path manually in request body like

```
        {
            "downloadPath": "D:\\temp",
            "objectID": "1234"
        }

```

Then also it shows single slash in console request body

![image](https://us1.discourse-cdn.com/getpostman/original/3X/a/6/a6cc4efaa3903e6a6d0f4dfa3aa68ec391885e2f.png)

and still it works.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 28, 2020, 9:17am UTC](https://community.postman.com/t/how-to-send-value-which-contains-backward-slash-dynamically-in-postman-request-body/12221/4 "2020-04-28T09:17:16Z")

</div>

Did the actual request send the file that you wanted, from the Collection runner?

When I use the Collection Runner, I see this as the preview of the file:

 ![Screenshot 2020-04-28 at 10.09.27](https://us1.discourse-cdn.com/getpostman/original/3X/0/9/0971d1ff1e92f0ac6c37722607396bee95347a8f.jpeg)

This is what the request body looks like for that request:

 ![Screenshot 2020-04-28 at 10.10.14](https://us1.discourse-cdn.com/getpostman/original/3X/9/7/97158cca81dfd8d4db3fbf95821b42793723c7d3.png)

What does the request look like for you, in this view? Ensure to select `Save responses` before running the Collection.

I’m not sure why the Console Log output looks like that, I get the same thing, that might be a separate issue with the way that’s parsed, compared to what’s sent in the runner.

---

<div class="post-metadata">

**Author:** ![Prachii](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@Prachii](https://community.postman.com/u/Prachii)\
**Post date:** [April 29, 2020, 4:32pm UTC](https://community.postman.com/t/how-to-send-value-which-contains-backward-slash-dynamically-in-postman-request-body/12221/6 "2020-04-29T16:32:32Z")

</div>

Hi @danny-dainton,

Actually solution with four backward slashes worked. I was making a spelling mistake while trying it at first. Really appreciate your efforts.

I will mark it as answered.

Thanks again!

---

<div class="post-metadata">

**Author:** ![lkpe](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lkpe](https://community.postman.com/u/lkpe)\
**Post date:** [October 30, 2023, 3:21pm UTC](https://community.postman.com/t/how-to-send-value-which-contains-backward-slash-dynamically-in-postman-request-body/12221/7 "2023-10-30T15:21:14Z")

</div>

Another solution is to replace backslash with “%5C”.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [November 2, 2023, 3:21pm UTC](https://community.postman.com/t/how-to-send-value-which-contains-backward-slash-dynamically-in-postman-request-body/12221/8 "2023-11-02T15:21:33Z")

</div>

Closed on November 2, 2023, 3:21pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
