I am trying to create request with a Pre-request script where I have an array. Then I am trying to use that array in a request. When I use the variable reference I get the array as a comma separated string of the elements. How can I get the array correctly?
Example: Pre-request script
ambiances = [“FAMILY_KIDS_FRIENDLY”, “TRADITIONAL”, “MODERN”, “ROMANTIC”]
pm.environment.set(“ambiances”, ambiances)
Body:
“ambiances_list”: “{{ambiances}}”
Console:
console.log(pm.environment.get(‘ambiances’)) :
(2) [true, false]
- 0: true
- 1: false
console.log(pm.environment.replaceIn(‘{{ambiances}}’)):
“true,false”