mholt/PapaParse

encode null/missing values in unparse

Open

#350 aperta il 17 ott 2016

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)JavaScript (1157 fork)batch import
good first issuehelp wantedsuggestion

Metriche repository

Star
 (11.877 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Hi papas,

CSV has no concept of null. You can't distinguish between empty strings and null. (good read: http://www.garretwilson.com/blog/2009/04/23/csvnull.xhtml)

Nevertheless, there are cases where you need to support both cases, so a solution might be to encode it as a special String like "NULL" or so (if its unlikely that this string will ever occure as a string in your app).

If you feed data where some fields are missing to papa.unparse, these fields will be empty in the resulting csv. is it possible to define another value for missing data, so that you could define "NULL" or similar for theses cases?

Guida contributor