How to fetch Fetch stringified array as object in request body

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?

Answered here. Please check.

1 Like