node-csvtojson icon indicating copy to clipboard operation
node-csvtojson copied to clipboard

CSV field to JSON array

Open Sr-Guapo opened this issue 6 years ago • 1 comments

Does anybody know how I can convert the gallery field in the CSV into a JSON array? The field is a list of image URLs separated by pipes.

I have the following CSV. Capture3

At the moment the result I get from csvtojson is: result

I am trying to create the following. If somebody can point me to the right direction. Capture2

Sr-Guapo avatar Oct 25 '19 21:10 Sr-Guapo

solved it for now with:

const converter = csv({
    colParser:  {"gallery":function(item, head, resultRow, row, colIdx) {return item.split("|")}},
});

marcolink avatar Dec 04 '19 10:12 marcolink