Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node Js stream incorrect CSV to JSON parsing when first cell is empty #706

Closed
GraceDmello opened this issue Sep 11, 2019 · 0 comments
Closed

Comments

@GraceDmello
Copy link
Contributor

Observation:
When using node js stream mode and header is true then it results into parsing error

var readStream = fs.createReadStream(__dirname + '/header-sample.csv', 'utf8');
var csvStream = readStream.pipe(Papa.parse(Papa.NODE_STREAM_INPUT, {header: true}));

CSV:

title,name
test title 01,test name 01
,test name 02

Parsing output
[ { title: 'test title 01', name: 'test name 01' }, { title: 't',name: 'e', __parsed_extra: [ 's', 't', ' ', 'n', 'a', 'm', 'e', ' ', '0', '2' ] } ] ]

Expected:

[
{ title: 'test title 01', name: 'test name 01' },
{ title: '', name: 'test name 02' }
]
GraceDmello pushed a commit to GraceDmello/PapaParse that referenced this issue Sep 11, 2019
Config: header: true, Node JS stream

Sample CSV

title,name
test title 01,test name 01
,test name 02
GraceDmello pushed a commit to GraceDmello/PapaParse that referenced this issue Sep 12, 2019
@pokoli pokoli closed this as completed in 94d7bf9 Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant