-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Description
Background Information
- Module Version:
3.7.0 - Node/Browser Version:
13.13.0
The issue I'm reporting is with:
- json2csv
- csv2json
I have...
- searched to see if an issue has already been reported.
- verified that my JSON/CSV data is valid (using something like http://jsonlint.com or https://csvlint.io/).
- tried upgrading to the latest version of json-2-csv (since the issue may already be fixed).
Expected Behavior
I have a csv with some rows that contains the string "39e1804". I want it to be a string when converted to json.
Actual Behavior
The csv string "39e1804" gets read as a number in scientific representation, and converted to the number "Infinity". Even if I use toString(), it reports the string "Infinity", since that's the number converted to string.
Data Sample
My csv gets read as a buffer, converted to string and then sent to csv2json.
CSV:
"code1,code2
test,39e1804"
(or)
JSON:
Code Example
// Please include a simple example to replicate the issue
let converter = require('json-2-csv');
const options = {
delimiter: {
eol: '\r\n'
},
excelBOM: true,
excelStrings: true
};
let final_json = await converter.csv2jsonAsync(file.data.toString(), options)Metadata
Metadata
Assignees
Labels
No labels