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

Set column one as header

Open 9thstudio opened this issue 4 years ago • 2 comments

Hi, Is the a way to set column 1 as header. My CSV looks like this and there is not header.

contact.name.text, jim contact.lastname.text, jorden contact.address.state.text, CA contact.city.text, LA

expected json {"contact" : { "name.text": "jim", "lastname.text": "jorden", "address": { "state.text": "CA", "city.text": "LA" } }

There is no header and I tried using ({noheader:true}) but the keys were all Field1 and Field2 which are expected.

9thstudio avatar Sep 25 '20 18:09 9thstudio

By default the 1st row of the csv file is the header https://github.com/Keyang/node-csvtojson#header-row

Do not define noheader because there is a header (1st row).

jfoclpf avatar Feb 10 '22 13:02 jfoclpf

@9thstudio if this solves your problem, please close the issue

jfoclpf avatar Feb 10 '22 13:02 jfoclpf