Please help me understand how to use the Map in Postman.
For example, in first test case I declared map like this:
let map = new Map();
map.set('first', 'value1');
pm.collectionVariables.set('map', map);
In second test case how to use this map?
I try like this, but not working:
let map = pm.collectionVariables.get("map");
typeAttrId.set('second', 'value2');
How to convert Postman variable to Javascript Map?
Thank you!
Please initialize before get from collection variable
let map=new Map()
map = pm.collectionVariables.get("map");
map.set('second', 'value2');
or try to use environment variable
var map = new Map();
map.set('hello','world');
console.log(map);
pm.environment.set('map',map);
var map2=new Map();
map2 = pm.environment.get('map');
map2.set('hello2','world2');
console.log(map2);