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

Keep the datatypes as is while converting csv to json

Open akshay-scalex opened this issue 5 years ago • 3 comments

I am converting a csv file to json using this library. I am facing the following issue. While converting my integer and float columns are getting converted to string. I do not want to do that.

Input csv file a,b,c 1,2,3 4,5,6

Output which is generated by library [ {a:"1", b:"2", c:"3"}, {a:"4", b:"5". c:"6"} ]

Expected output [ {a:1, b:2, c:3}, {a:4, b:5. c:6} ]

akshay-scalex avatar Sep 25 '20 05:09 akshay-scalex

I have the same issue. checkType parameter should solve your case, but it'll still convert "00001" into 1.

manufont avatar Sep 25 '20 07:09 manufont

The original file is a text file, thus string type comes by default. You can set checkType to true or use the built-in-parsers

jfoclpf avatar Apr 22 '22 09:04 jfoclpf

Hey I am facing this problem when converting csv to json file Can anybody provide the solution it would be great. Thanks

aayushgurung avatar Feb 21 '23 06:02 aayushgurung