zemirco / json2csv

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

Data trimmed issue #149

Closed monicasenapati closed 6 years ago

monicasenapati commented 7 years ago

When I change a json file to csv, in one of the columns, the integer gets rounded up. For example,an ID 740245381351497730 is displayed as 740245381351497700. Is there any work around this problem?

knownasilya commented 7 years ago

We don't do anything to round any values, it must be somewhere else. If you can create a reproduction, e.g. a failing test or a sample data set and commands, I can help look into any issues.

monicasenapati commented 7 years ago

I am converting Tweets.json to Tweets.csv.

As you can see, the ones in the ID column are rounded up. I was wondering a work around this issue, since I need the exact IDs.

Thanks & regards,

Monica


From: Ilya Radchenko notifications@github.com Sent: 24 October 2016 12:35:46 To: zemirco/json2csv Cc: Senapati, Monica (UMKC-Student); Author Subject: Re: [zemirco/json2csv] Data trimmed issue (#149)

We don't do anything to round any values, it must be somewhere else. If you can create a reproduction, i.e. a failing test, I can help look into any issues.

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/zemirco/json2csv/issues/149#issuecomment-255826781, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AUVUmSpek3v346B2sZOMnMrAb8DRC8diks5q3PqCgaJpZM4KfHlG.

knownasilya commented 7 years ago

Can you post a subset of that data and the commands you ran, so I can test it?

juanjoDiaz commented 6 years ago

That's not a problem with this library.

740245381351497730 is larger and the largest safest integer in javascript. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)

You can just try the code bellow:

const test = 740245381351497730;
if (test === 740245381351497700) {
  console.log('Trimmed');
} else {
  console.log('Not Trimmed');
}