question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NULL values being skipped

See original GitHub issue

I installed your module, and for the most part it is working great. I am pulling data from a database and then feeding the result (in a “simple array” format) into your module to get a “csv” output. However, when I went back and checked the resulting output, I noticed that my data did not match the order from the database.

More specifically, while all “NULL” values were converted to empty strings (it appears, anyway), the cells that contained “NULL” values were being eliminated from the proper order and being shifted to the end of that column’s “csv” results.

Data that is ordered like this in the database:

id       name       status        dateAdded       count
1        Bob          NULL         1-1-17               NULL
2       Martha      NULL       5-21-17             3
3        Paul         fired        10-3-17            18

Comes out like this in the csv results:

id,name,status,dateAdded, count 1,Bob,fired,1-1-17 ,3 2,Martha,5-21-17,18 3,Paul,10-3-17,

I have no options set, and am essentially running the function like this:

jsonexport(myjsondata, (err, csv) => { if(err) return console.log(err) return csv } )

Can anyone help me figure out why this is happening? It’s throwing my row data off and making the results unusable to send to clients or other co-workers. Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AckerApplecommented, Feb 23, 2018

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

0reactions
max-bruhncommented, Mar 28, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make line skip null values · Issue #3372 · vega/vega-lite - GitHub
This is a feature request forked from a comment in another issue,. null values shall be simply skipped and not connected with existings...
Read more >
How to NOT SKIP null values in spark JSON? - Stack Overflow
Show activity on this post. I have a DF which I am trying to parse in a schema. But the class which is...
Read more >
001086: Skipping features because of NULL values in <value ...
Some of the values are equal to NULL and will be ignored. Solution. Take note that some of the data values are NULL...
Read more >
How to filter all NULL values(or) Specific NULL Key-Value ...
Typically output directive attribute skipNullOn can be used to ignore null key-value pair in output with DataWeave.
Read more >
Solved: Compose action skipped due to Condition, but gives...
Solved: Hello, I have a flow that is checking in a source if a Sample ID exists. For all that do not exist,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found