Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set column one as header #405

Open
9thstudio opened this issue Sep 25, 2020 · 2 comments
Open

Set column one as header #405

9thstudio opened this issue Sep 25, 2020 · 2 comments

Comments

@9thstudio
Copy link

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.

@jfoclpf
Copy link

jfoclpf commented Feb 10, 2022

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
Copy link

jfoclpf commented Feb 10, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants