cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Convert CSV to required format

skodali
New Contributor III

Hello All,

Iโ€™m trying to Conver a CSV file to a JSON Format. Can anyone provide some inputs on how to achieve the required output format into a mapper?
Required Format:
{
โ€œvaluesโ€: [
[
โ€œRow1-Column1 Dataโ€,
โ€œRow1-Column2 Dataโ€
],
[
โ€œRow2-Column1 Dataโ€,
โ€œRow2-Column2 Dataโ€
]
]
}

Thanks,
Sasank

1 ACCEPTED SOLUTION

dimche_saveski
New Contributor III

Hello @skodali

I tested a bit with your issue and come up with some solution. Please check this pipeline and the csv test file, and see if that can help you.
test2_2020_06_12.slp (8.8 KB)

and csv file structured like screenshot bellow
Screenshot_2

BR
Dimche Saveski

View solution in original post

11 REPLIES 11

N number or rows should be bigger than number of expected input records. If you expecting 100 records , set that number 700 , just to be on the safe side.

P.s Updated the pipeline and the file
BR

@dimche.saveski
Updated pipeline is resulting in different structure compared to the required format.
image

Iโ€™ve tried to achieve structure like your original post requirements, on the left is result on the right requirements:
Screenshot_3

Maybe you like to achhieve Row1 : Column1 key value pairs?

BR

@dimche.saveski

Updated pipeline almost resulted the desired format but โ€œvaluesโ€ should not be the target path. Values text should be part of JSON like:
image

Pipeline results were like:
image

Just add โ€œrequiredResultโ€ before the โ€œvaluesโ€ field in the last mapper of the pipeline, like this
Screenshot_4