And here’s my javascript code for reading the data. I tried to use the .slice function to remove the double quotes when reading the values in the csv file.
parameters = [‘pageNumber’]
for (i=0; i<parameters.length; i++)
{
readValueInCSV = pm.iterationData.get(parameters[i]);
console.log ("Value of pageNumber: " + readValueInCSV);
temp = readValueInCSV;
temp = temp.slice(1, temp.length-1);
console.log ("Value of pageNumber after slice: " + temp);
pm.environment.set(parameters[i], temp)
}
After running the datadriven, the double quotations were actually removed in the local environment. Please see screenshot below:
My point is… I want to read datas enclosed in double quotation marks and store them in local environment variables that can be passed to the Params and using only GET Method.
Sorry for the late response. I finally got it! Thank you very much for informing me about that “data” special variable. My concern has been completely answered.
I was able to traverse and loop through all the items in the JSON file by using the data variable.
Also, my mistake because i got a different double quotes after i opened it in notepad++. That’s why in Postman they displayed diamonds with question marks.