# JSON Stringify request body using raw

**URL:** <https://community.postman.com/t/json-stringify-request-body-using-raw/5526>\
**Category:** Help Hub\
**Created:** [May 21, 2019, 2:50pm UTC](https://community.postman.com/t/json-stringify-request-body-using-raw/5526 "2019-05-21T14:50:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![davems](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@davems](https://community.postman.com/u/davems)\
**Post date:** [May 21, 2019, 2:50pm UTC](https://community.postman.com/t/json-stringify-request-body-using-raw/5526/1 "2019-05-21T14:50:23Z")

</div>

Hello,

We’re using API Gateway and the request body needs to be stringified before sending. Right now, I the request body with a json under “raw” and the content-type of application/json.

I’ve tried using:

```
var body = {
name: 'Test'
};

pm.environment.set('req_body', JSON.stringify(body));

```

Then passing in `{{req_body}}`, but it’s coming in as the whole stringified object as a key with an empty value.

Any ideas in this particular scenario how to get this to work in Postman?

Thank you

---

<div class="post-metadata">

**Author:** ![VincentD123](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vincentd123/32/1845_2.png) [@VincentD123](https://community.postman.com/u/VincentD123)\
**Post date:** [May 21, 2019, 9:07pm UTC](https://community.postman.com/t/json-stringify-request-body-using-raw/5526/2 "2019-05-21T21:07:57Z")

</div>

HI @davems

Could you give a bit more details please? I tried the following which seemed to work as expected

**Pre-request script**  
 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/a/a8f8fc67f7f4ae54ff0697b2912dc8ba8ccbdd74.png)

**Body**  
 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/d/d8f3bd6a3d896745ca07dea62b3e5abd597201c6.png)

**Console after sending** (pretty)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/4/9/491d7889f98f729123876bf51b7c39b840c6da32.png)  
**or raw**  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/4/4/4424a5fa9a5d3e89efc37fc33e6f8f155149f0b6.png)  
(Note: Google replied with Error 405 (Method Not Allowed)!! as you’d expect.)

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [August 27, 2019, 11:38am UTC](https://community.postman.com/t/json-stringify-request-body-using-raw/5526/3 "2019-08-27T11:38:54Z")

</div>

For future user’s landing on this issue:

Make sure your request body is only this (no quotes around the variable name, otherwise it’ll get converted to a string):

```javascript
{{req_body}}

```

and not this:

```auto
"{{req_body}}"

```

Here’s a collection showing you how to do it directly in Postman, feel free to fork it and edit it to your needs: [Postman](https://www.postman.com/postman/workspace/postman-answers/collection/9215231-b9133e48-73c3-4aa4-b189-e038ee4c5e00?ctx=documentation)

---

<div class="post-metadata">

**Author:** ![hblee8080](https://avatars.discourse-cdn.com/v4/letter/h/9e8a1a/32.png) [@hblee8080](https://community.postman.com/u/hblee8080)\
**Post date:** [April 20, 2021, 8:25am UTC](https://community.postman.com/t/json-stringify-request-body-using-raw/5526/4 "2021-04-20T08:25:52Z")

</div>

thank you so much for your answer.

---

<div class="post-metadata">

**Author:** ![maintenance-geologis](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@maintenance-geologis](https://community.postman.com/u/maintenance-geologis)\
**Post date:** [May 20, 2021, 3:15am UTC](https://community.postman.com/t/json-stringify-request-body-using-raw/5526/5 "2021-05-20T03:15:19Z")

</div>

Hi, I have some problem regarding getting timeCardId on my respose body. It’s Getting Null value.  
Please Help

 ![111](https://us1.discourse-cdn.com/getpostman/original/3X/3/9/39213f634219ce5410e9786459229e2410dfff15.png)  
 ![222](https://us1.discourse-cdn.com/getpostman/original/3X/b/e/be3af7d243682a8f79d722842f4c52460dde4140.png)  
 ![333](https://us1.discourse-cdn.com/getpostman/original/3X/a/c/ac3287b71cb0eb367bed1e9d0b274bd19e5f9568.png)

---

<div class="post-metadata">

**Author:** ![buaaytt](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@buaaytt](https://community.postman.com/u/buaaytt)\
**Post date:** [January 9, 2023, 11:40am UTC](https://community.postman.com/t/json-stringify-request-body-using-raw/5526/6 "2023-01-09T11:40:12Z")

</div>

What if I only want one field to use this JSON, not the entire request body? e.g.  
{  
“SomeProperty”: “SomeValue”,  
“JsonProperty”: {{jsonValue}}  
}  
How should I set the {{jsonValue}}?
