Create structured JSON object from CSV file in JavaScript?
问题 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 having trouble structuring the JSON in the desired way. My code for loading the CSV file looks like this: <!DOCTYPE html> <html> <body> <p>Select local CSV File:</p> <input id="csv" type="file"> <output id="out"> input file content</output> <script> var fileInput = document.getElementById("csv"), readFile = function () { var reader = new