mrodrig / json-2-csv

Convert JSON to CSV *or* CSV to JSON!
https://mrodrig.github.io/json-2-csv
MIT License
421 stars 58 forks source link

No keyPath was provided #203

Closed joostdebruijn closed 3 years ago

joostdebruijn commented 3 years ago

Background Information

The issue I'm reporting is with:

I have...

Expected Behavior

I have a CSV-file with a header. The last two columns have no header title. Until version 3.1.1 this worked, from version 3.2.0 onwards this is broken, receiving the error message No keyPath was provided.. The upgrade to doc-path@2.0.0 changed this behavior. It throws an error because in csv2json.js:294 key.value contains an empty string.

Actual Behavior

I would expect a minor version upgrade wouldn't break my project and the conversion has the same result as before (the empty columns where just ignored). :)

mrodrig commented 3 years ago

Hi @joostdebruijn. Thanks for reporting this and sorry for the inconvenience this caused. In the process of improving the input validation for doc-path, it certainly introduced a bug for your use case in json-2-csv. I've added a test for this use case so I'll be able to ensure that won't happen again. I just published a release with a fix for this issue in 3.14.2, so please let me know if you're still experiencing this, or if there's anything else that you see that doesn't look quite right. Thanks again.

joostdebruijn commented 3 years ago

Hi @mrodrig, I just test it with the latest version and the problem is solved. Thanks for the quick response and fix!