# How to fetch Fetch stringified array as object in request body

**URL:** <https://community.postman.com/t/how-to-fetch-fetch-stringified-array-as-object-in-request-body/4744>\
**Category:** Help Hub\
**Tags:** tests, testscripts\
**Created:** [March 28, 2019, 5:15am UTC](https://community.postman.com/t/how-to-fetch-fetch-stringified-array-as-object-in-request-body/4744 "2019-03-28T05:15:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ra\_Na](https://avatars.discourse-cdn.com/v4/letter/r/54ee81/32.png) [@Ra\_Na](https://community.postman.com/u/Ra_Na)\
**Post date:** [March 28, 2019, 5:15am UTC](https://community.postman.com/t/how-to-fetch-fetch-stringified-array-as-object-in-request-body/4744/1 "2019-03-28T05:15:46Z")

</div>

I have a request where based on a environment variable i have a array of values

```
 let flavor= "";
 if (os.toLowerCase() === "windows") {
      flavor= ["hello","hi"];
  }
  else {
      flavor = ["hello","hi","how do you do"];
   }
   pm.environment.set("flavor",JSON.stringify(flavor));

```

Now in POST body i have the following:

```
{ 
   "connection": "{{connect}}",
   "type": {{flavor}},
   "name": "",
}

```

Unable to use the stringified array from environment vairable as an array object?  
How to go about this?

---

<div class="post-metadata">

**Author:** ![deepak.pathania](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@deepak.pathania](https://community.postman.com/u/deepak.pathania)\
**Post date:** [March 28, 2019, 9:33am UTC](https://community.postman.com/t/how-to-fetch-fetch-stringified-array-as-object-in-request-body/4744/2 "2019-03-28T09:33:06Z")

</div>

Answered [here](https://community.postman.com/t/set-array-from-environment-variable-for-request-body-in-postman/4743/2). Please check.
