Create structured JSON object from CSV file in JavaScript?

前端 未结 3 922
鱼传尺愫
鱼传尺愫 2021-01-15 12:45

I want to create a JSON object from the contents of a CSV file. The CSV file is loaded locally via the FileReader API and that seems to work, however I am havin

3条回答
  •  情话喂你
    2021-01-15 13:16

    If you are struggling to parse data, you can also use PapaParse, it has a lot of configurations and it's pretty easy to use:

    // Parse CSV string
    var data = Papa.parse(csv);
    

    See more information at https://www.papaparse.com/demo

提交回复
热议问题