node-csvtojson icon indicating copy to clipboard operation
node-csvtojson copied to clipboard

Creating Object for Header with Period in the Name

Open ClimbThatApple opened this issue 4 years ago • 3 comments

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?

ClimbThatApple avatar Nov 08 '21 22:11 ClimbThatApple

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 avatar Jan 09 '22 22:01 jfoclpf

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

jfoclpf avatar Jan 09 '22 23:01 jfoclpf