# Using CSV file for data variables

**URL:** <https://community.postman.com/t/using-csv-file-for-data-variables/946>\
**Category:** Help Hub\
**Created:** [February 15, 2018, 3:05pm UTC](https://community.postman.com/t/using-csv-file-for-data-variables/946 "2018-02-15T15:05:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_BRL](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@Dan\_BRL](https://community.postman.com/u/Dan_BRL)\
**Post date:** [February 15, 2018, 3:05pm UTC](https://community.postman.com/t/using-csv-file-for-data-variables/946/1 "2018-02-15T15:05:47Z")

</div>

Hi All

First post, please be gentle 🙂

I’m using a CSV file to pass data variables to my requests in the runner. Everything seems to be going great I’m just getting stuck on one variable. I’m trying to pass a list of items but it doesn’t seem to be working.

In my POST request I have…  
{“name”: [“{{products”}}]}

and in my CSV file under the products header I have…  
{“itemQTY”:2,“itemPrice”:“\u00A32.70”,“itemName”:“HOT CHOC”,“itemSKU”:34},{“itemQTY”:1,“itemPrice”:“\u00A32.00”,“itemName”:“PAIN AU CHOC”,“itemSKU”:251},{“itemQTY”:1,“itemPrice”:“\u00A32.00”,“itemName”:“ENGLISH BREAKFAST”,“itemSKU”:197}

I think I know what the problem is, the product data from the CSV file is being imported as a string instead of the actual format I want it. But I don’t know what I need to do to change that 🤔

Any help would be much appreciated 😃

Dan

---

<div class="post-metadata">

**Author:** ![dhoyt](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/dhoyt/32/238_2.png) [@dhoyt](https://community.postman.com/u/dhoyt)\
**Post date:** [February 19, 2018, 6:34pm UTC](https://community.postman.com/t/using-csv-file-for-data-variables/946/2 "2018-02-19T18:34:35Z")

</div>

@Dan_BRL

I’m thinking that you want that product data in JSON format ?

If so, here is a test example where I copied your example string into a variable. I had to change your “ in your post to " in order to make it work.

```javascript
var productString = '{"itemQTY":2,"itemPrice":"\u00A32.70","itemName":"HOT CHOC","itemSKU":34}';

var productJSON = JSON.stringify(eval('('+productString+')'));
var productJSON = JSON.parse(productJSON); 

console.log(productJSON.itemName);
console.log(productJSON.itemPrice);

```

What I saw in the console …

```auto
HOT CHOC
£2.70

```

Here is what you might do because your “product” variable is being loaded from the CSV file …

```javascript
var productJSON = JSON.stringify(eval('('+pm.environment.get('product')+')'));
productJSON = JSON.parse(productJSON); 

console.log(productJSON.itemName);
console.log(productJSON.itemPrice);

```
