# Csv data to json object in 1 iteration

**URL:** <https://community.postman.com/t/csv-data-to-json-object-in-1-iteration/19928>\
**Category:** Help Hub\
**Tags:** variables, runner, request-body, csvdatafile, pre-request\
**Created:** [February 3, 2021, 10:54am UTC](https://community.postman.com/t/csv-data-to-json-object-in-1-iteration/19928 "2021-02-03T10:54:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariampostwoman](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@mariampostwoman](https://community.postman.com/u/mariampostwoman)\
**Post date:** [February 3, 2021, 10:54am UTC](https://community.postman.com/t/csv-data-to-json-object-in-1-iteration/19928/1 "2021-02-03T10:54:53Z")

</div>

I need to send a post request where the body of my schema has the following format with fixed data, arrays and objects:  
{  
“Ownerid”: “JohnDoe”,  
“Animal” : “Cat”,  
“Breeds”: [  
{ “Breed”: “Siamese”,  
“Color”:“Brown”  
},  
{ “Breed”: “Tabby”,  
“Color”:“Orange”}  
],  
“Type”: “Domestic”  
}

I need to be able to import a csv file where the data is added. This is what I did:  
I created a csv with the columns being the variables and it looked like this:  
Ownerid,Animal,Breed,Color,Type  
JohnDoe,Cat,Siamese,Brown,Domestic  
JohnDoe,Cat,Tabby,Orange,Domestic  
I modified the body to include/get the variables so it looked like this:  
{  
“Ownerid”: {{Ownerid}},  
“Animal” : {{Animal}},  
“Breeds”: [  
{ “Breed”: {{Breed}},  
“Color”:{{Color}}  
}  
“Type”: {{Type}}  
}  
This works fine in Runner as long as each owner has only one animal (one row of data). As soon as I have more it separates the values into different post requests when it should be 1. Is there any way I can do this? I need the breed to contain as many cats as the owner has. This data should be in the rows of the csv file I am using in runner.  
I’ve tried several code in the pre-request but nothing seems to work.
