I want to post integer column value as string. Can you please help how to convert integer to string in the following example. This is posting last two column (Qty & price) value as integer instead of string.
columns in CSV file
item_id,title,bullets1,bullets2,bullets3,bullets4,bullets5,qty,price
1234,men shoes,Textile,Rubber sole,Lace up closure,fabric lining, ,989,10
Pre-request script:
const requestBody = {
item_id: null,
fields: []
};
for (let [key, value] of Object.entries(data)) {
if (key.startsWith('bullets') || key === 'title') {
if (value !== '') {
requestBody.fields.push({
name: key,
value: value
});
}
} else {
requestBody[key] = value;
}
}
pm.variables.set('requestBody', JSON.stringify(requestBody));
Thanks.
Adac