Comments (13)
FYI pull request #46 is a result of this issue report. I just added more testing measures
from jsonexport.
@threepears Can you share the JSON? I cant reproduce your issue
var contacts = [{
name: 'Bob',
lastname: 'Smith',
status: null,
test: true
},{
name: 'James',
lastname: 'David',
status: 'fired',
test: true
}];
jsonexport(contacts, function(err, csv){
if(err) return console.log(err);
console.log(csv);
});
Result
name,lastname,status,test
Bob,Smith,,true
James,David,fired,true
from jsonexport.
@kauegimenes : thank you for getting back to me, and sorry for the lateness of my response. I, unfortunately, cannot share the exact JSON, as that involves company information. However, I can tell you that there were many columns (probably approaching 225) in the database, but the data was not complex .... it looked pretty much per my example above, just a much, much larger object. Have you tested this module with very large objects with a couple hundred keys?
Also of note: it happened whether there were many rows or just three, so I don't think the number of rows had anything to do with it.
As my project was at deadline, I did end up using another method to finish the assignment, but I figure it doesn't hurt to document this issue in case it comes up again in the future for someone else. Thank you very much for your time, and let me know if you have any further questions!
from jsonexport.
@threepears I just tested jsonexport using a json with 300+ cols and i was unable to reproduce this bug, can you share at least 3 rows of your data? you can randomize the values just keeping the data types.
from jsonexport.
We found the same issue here.
What we found is the issue is reproducible on Ubuntu whereas Mac could not reproduce this issue.
For example, if JSON is
{
'a' : 'another field',
'b' : '',
'c' : 'other field'
}
the csv column that jsonexport produce on Ubuntu is:
'a', 'b', 'c'
'another field', 'other field'
whereas on Mac is:
'a', 'b', 'c'
'another field', '', 'other field'
from jsonexport.
@MonaiThang Can you help fix this issue?
I don't have any computer running Ubuntu currently.
from jsonexport.
@AckerApple Can you reproduce this issue?
from jsonexport.
My thought was to see if a unit test could be made and run against Appveyor or Travis
But I donโt even know if they run a Ubuntu instance.
Iโll spend an ounce of time researching. Brb
from jsonexport.
I flat out tried a lot to get jsonexport to fail in regards to nulls. It's working as expected everywhere I test.
I added the discussed tests from this issue into the jsonexport unit tests and ran them everywhere. Passed everywhere, with the same results everywhere.
I read a lot about Travis's testing and added settings to ensure jsonexport is tested on a Ubuntu instance.
I added Appveyor CLI testing. All tests pass. Appveyor tests Windows.
I tested all mentioned data issues using the demo page for jsonexport . All tests passed.
Sorry you peeps with the issues. I found none myself
from jsonexport.
Thanks for the help @AckerApple!
I will try installing Ubuntu in a VM this weekend
@MonaiThang Can you try debug the module to understand why this is happening?
from jsonexport.
I debugged the app and found that it produces the content as expected (from the variable that parsed into CSV data). However, the Ubuntu instance that has issues somehow could not display the content correctly.
I think the issue might be from the CSV reader itself instead of the library because I could not reproduce this issue on the newly installed Ubuntu instance.
Sorry for passing on the inaccurate information.
from jsonexport.
Just tested the module with Ubuntu 17, all tests ok.
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 17.10
Release: 17.10
Codename: artful
$ npm -v
5.6.0
$ node -v
v9.8.0
$ npm test
36 passing (26ms)
from jsonexport.
Hello, I have encountered the described problem on a Mac (10.15)
Empty and null values are skipped and the value from a line below is inserted into the skipped row and the last line is duplicated to fill the empty field at the end.
JSON
[ { "id": 28374928374, "items": [ { "variant_id": 345635638378, "properties": [ { "name": "prop1", "value": "some value1" }, { "name": "prop2empty", "value": "" }, { "name": "prop3", "value": "some value3" }, { "name": "prop4", "value": "some value4" }, { "name": "prop5", "value": "some value5 " }, { "name": "prop6", "value": "some value6" }, { "name": "prop7null", "value": null }, { "name": "prop8", "value": "some value8" } ] } ] } ]
CSV produced by jsonexport
id,items.variant_id,items.properties.name,items.properties.value 28374928374,345635638378,prop1,some value1 28374928374,345635638378,prop2empty,some value3 28374928374,345635638378,prop3,some value4 28374928374,345635638378,prop4,some value5 28374928374,345635638378,prop5,some value6 28374928374,345635638378,prop6,some value8 28374928374,345635638378,prop7null,some value8 28374928374,345635638378,prop8,some value8
from jsonexport.
Related Issues (20)
- Stream does not support typeHandlers option HOT 3
- How to remove the title option from inside xls file
- Nested JSONObject not correctly mapping to csv
- Update v2.5.2 to v2.5.3 with Bug Fixes for package.json stuck on v2
- verticalOutput with Arrays HOT 1
- No option to ignore fields / limit fields to export ? HOT 2
- large files not converting HOT 10
- (I think I) found a bug HOT 6
- typeHandlers tests & more samples
- speed question/issue HOT 4
- Column values with zero (0) are being replaced with "" HOT 3
- Complex JSON array - unexpected behavior HOT 1
- Need Help : Complex Json Array to CSV HOT 2
- Json Complex Example HOT 2
- JSON Array not converting to CSV HOT 1
- TypeError: this._options.handleDate is not a function HOT 5
- Question. What is expected behaviour when exporting objects where some do not have all fields in header HOT 12
- typeHandlers is not part of UserOptions HOT 2
- CLI: Json Complex Object outputting all keys as headers HOT 11
- Exporting a dataset with a hashtag (#) in a string breaks CSV HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonexport.