SaiSurya9999 / ngx-csvto-json

Angular Library to convert CSV to JSON array.
3 stars 0 forks source link

Deleting result array object value when comma character is present #11

Open pouyababaie opened 1 year ago

pouyababaie commented 1 year ago

I have a .csv file :

Code
sdfgfjhgj
fghfgh
fhjghkm,khhk
skds;dfhcs
fgjhgjkl
hkljollop
guygko
njkhg4@@
dfg;453e2
sdfghjkhjk
iuygbikugiug
jhfjkgkig
jyhfjjhgkgk

when there is a comma character " , " in a string , the component (onConvert) method somehow manipulates the data and deletes the rest of the string.

in the example above , in row 3 ( starting from 0) when there is a comma in a string , somehow it turns into :

[ { "code": "sdfgfjhgj" }, { "code": "fghfgh" }, { "code": "\"fhjghkm" }, { "code": "skds;dfhcs" }, { "code": "fgjhgjkl" }, { "code": "hkljollop" }, { "code": "guygko" }, { "code": "njkhg4@@" }, { "code": "dfg;453e2" }, { "code": "sdfghjkhjk" }, { "code": "iuygbikugiug" }, { "code": "jhfjkgkig" }, { "code": "jyhfjjhgkgk" }, { "code": "" } ]

iTheRudy commented 1 year ago

I'm having the issue with comma too Did you find any way to solve this?

pouyababaie commented 1 year ago

@iTheRudy i actually had to change the library that i use to resolve this issue,. here is the library that i use.

papaparse

iTheRudy commented 1 year ago

@pouyababaie Thanks I used another library called 'ngx-csv-parser' That works well too

pouyababaie commented 1 year ago

@iTheRudy good luck :)