Coder Social home page Coder Social logo

Comments (13)

AckerApple avatar AckerApple commented on July 30, 2024 1

FYI pull request #46 is a result of this issue report. I just added more testing measures

from jsonexport.

kaue avatar kaue commented on July 30, 2024

@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.

threepears avatar threepears commented on July 30, 2024

@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.

kaue avatar kaue commented on July 30, 2024

@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.

MonaiThang avatar MonaiThang commented on July 30, 2024

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.

kaue avatar kaue commented on July 30, 2024

@MonaiThang Can you help fix this issue?
I don't have any computer running Ubuntu currently.

from jsonexport.

kaue avatar kaue commented on July 30, 2024

@AckerApple Can you reproduce this issue?

from jsonexport.

AckerApple avatar AckerApple commented on July 30, 2024

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.

AckerApple avatar AckerApple commented on July 30, 2024

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.

kaue avatar kaue commented on July 30, 2024

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.

MonaiThang avatar MonaiThang commented on July 30, 2024

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.

kaue avatar kaue commented on July 30, 2024

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.

max-bruhn avatar max-bruhn commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.