mrodrig / json-2-csv

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

Field in CSV it turned into an object unexpectedly. #254

Closed hydrohiester closed 6 months ago

hydrohiester commented 6 months ago

Background Information

The issue I'm reporting is with:

I have...

Expected Behavior

CSV Header: 'Account No.' CSV Field: '01-1800-00'

I expect to get: {'Account No.': '01-1800-00'}

Actual Behavior

It gets converted to { 'Account No': { '': '01-1800-00' }}

If I remove the period in "Account No." it works correctly. Is a period not allowed in a heading?

I tried setting excelBOM to true, but it didn't make a difference.

mrodrig commented 6 months ago

Hi @hydrohiester, thanks for reporting this. That definitely sounds like a bug to me. My guess is the parsing logic needs an update to account for that possibility, since it's completely valid.

I'm currently traveling with no access to my typical development machine, but should hopefully be able to take a closer look at this either later this weekend or early next week. I'll keep you posted.

mrodrig commented 6 months ago

Thanks again for reporting this @hydrohiester. It ended up being a different issue with the logic in my doc-path package rather than what I expected, but it should be resolved now in version 5.5.1 that I just published.