micado-eu / pa_application

application for the PA
European Union Public License 1.2
1 stars 4 forks source link

Migration in figures: Using a csv with commas as fields results in wrong parsing #171

Open ivchicano opened 3 years ago

ivchicano commented 3 years ago

When converting the CSV to JSON if a field has commas (between "") it parses it wrong: For example for row (with headers Municipality,Percentage of migrant population over the total population): "Acebeda, La",1.41 it should be parsed as:

{
    "Municipality": "Acebada, La",
    "Percentage of migrant population over the total population": 1.41
}

instead, it is parsed as:

{
    "Municipality":"\"Acebeda",
    "Percentage of migrant population over the total population":" La\""
}

This may be helpful https://www.npmjs.com/package/csvtojson