Keyang / node-csvtojson

Blazing fast and Comprehensive CSV Parser for Node.JS / Browser / Command Line.
MIT License
2.02k stars 270 forks source link

Creating Object for Header with Period in the Name #434

Open ClimbThatApple opened 2 years ago

ClimbThatApple commented 2 years ago

I have headers that contain "." and the parser is creating an object like follows: {"SKU":"SOMESKU","\"Google":{"com\"":"135.99"}}

the expected output would be: {"SKU":"SOMESKU","Google.com":"135.99"}}

I am using the .fromString() method for converting. Is there something I am missing?

jfoclpf commented 2 years ago

Does the CSV file contain the quotes?

Have you also tried changing the quote option

quote: If a column contains delimiter, it is able to use quote character to surround the column content. e.g. "hello, world" won't be split into two columns while parsing. Set to "off" will ignore all quotes. default: " (double quote)

jfoclpf commented 2 years ago

I read now you say you're using fromString(). What is the string exactly?

mebibou commented 1 month ago

See my comment here: https://github.com/Keyang/node-csvtojson/issues/477#issuecomment-2311954088

seems like the same problem