I am trying to set an array as an environmental variable in postman. But it stores the first value of the array rather than the array.
var aDataEntry = postman.pm.environment.get('data_set_entries');
if(aDataEntry == null) {
aDataEntry = [];
}
var jsonData = pm.response.json();
aDataEntry.push(jsonData.dataEntry.id);
// a console.log here confirms that aDataEntry is an array
postman.pm.environment.set('data_entry',aDataEntry);
As mentioned in the comment of the code, the variable is coming as an array, but when I again get the environment variable in the second run, it is not of type array. But just contains the first element in the array.
What's wrong here? How can set the array and use it from the postman environment variable.