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

The Nested CSV doesn't convert to JSON properly #443

Open
pranaymistry opened this issue Apr 5, 2022 · 2 comments
Open

The Nested CSV doesn't convert to JSON properly #443

pranaymistry opened this issue Apr 5, 2022 · 2 comments

Comments

@pranaymistry
Copy link

When I use the sample nested CSV provided and I try to run it in VS Code I don't get the desired JSON output. Please help resolve this issue ASAP.

My Test CSV

image

JS Code

const csvFilePath='test.csv' const csvtojsonV2=require("csvtojson/v2"); csvtojsonV2() .fromFile(csvFilePath) .then((jsonObj)=>{ console.log(jsonObj); /** * [ * {a:"1", b:"2", c:"3"}, * {a:"4", b:"5". c:"6"} * ] */ })

VS Code Output

image

Full VS Code JS Code with output

image

Even on the MAC Terminal I get the same [Array] for the nested JSON object and not the actual JSON

image

@jfoclpf
Copy link

jfoclpf commented Apr 22, 2022

I don't understand your problem, the the console.log seems to output correctly the content of jsonObj

What did you expect to see?

@markericson
Copy link

@pranaymistry maybe your concern is you are seeing JavaScript array/objects and not JSON formatted array/objects? You will see the JSON format if modify your: console.log(jsonObj) to: console.log(JSON.stringify(jsonObj))

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

3 participants