zemirco / json2csv

Convert json to csv with column titles
http://zemirco.github.io/json2csv
MIT License
2.71k stars 365 forks source link

Issue converting columns with boolean value #156

Closed qiusli closed 6 years ago

qiusli commented 7 years ago

If the values of a particular column are of type boolean, the generated file will have that column with uppercase TRUE or FALSE. I tried to pass lowercase string 'true' or 'false' but still they got converted to uppercase. Any suggestions? Thanks,

qiusli commented 7 years ago

after taking a closer look at the generated file and compare with another csv file which was generated from a Java project I found that the biggest difference is the data feed to microsoft excel, the one generated from json2csv has double quotes around each value while the original data from the other csv does not have double quotes around each of its value, maybe this could cause excel to translate data passed in in a different way.

qiusli commented 7 years ago

after converting boolean value to its string version and set excelString attribute to true solved the problem, but still if the value is boolean, it got translated to all uppercase in excel.

juanjoDiaz commented 6 years ago

I just tested this and it seems to work fine for me. The casing is never changed.true and false are always lowercase

Using the quote: '' option you can get a CSV without quotes around the cells. Similarly, using the excelString: true option. Neither of those options would affect the boolean values since they are not strings.

It might be that excel just display boolean values in uppercase, in which case is an issue with excel and not with this library.

Please feel free to reopen if I misunderstood and this is still an issue.