Keyang / node-csvtojson

Blazing fast and Comprehensive CSV Parser for Node.JS / Browser / Command Line.
MIT License
2.02k stars 271 forks source link

CSV field to JSON array #348

Open Sr-Guapo opened 5 years ago

Sr-Guapo commented 5 years ago

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

marcolink commented 4 years ago

solved it for now with:

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