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

Double quotes in CSV cause error #12

Closed
benkamin opened this issue Jan 17, 2017 · 1 comment
Closed

Double quotes in CSV cause error #12

benkamin opened this issue Jan 17, 2017 · 1 comment

Comments

@benkamin
Copy link

When parsing CSV, escaped double quotes cause error.
TypeError: Cannot read property '0' of null at node_modules/csvjson/index.js:74:55 at Array.forEach (native) at node_modules/csvjson/index.js:73:21 at Array.forEach (native) at Object.toObject (node_modules/csvjson/index.js:67:13)

Double quotes in CSV are escaped with double quotes, so it looks looks like this:
"this string contains ""double quotes"""
But using toObject to parse CSV files which includes such escaped quotes seems to invoke this error.

@pradeep-mishra
Copy link
Owner

try like this

var result = csvjson.toObject(data, { quote : true });

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

2 participants