I have a similar answer like the code by iwek re-shared in Wesley Smith's answer, but my code can be used in conjunction with Excel directly (copy and paste from Excel into a textarea).
function csvUpload(csvText){
        //Split all the text into seperate lines on new lines and carriage return feeds
        var allTextLines = csvText.split(/\r\n|\n/);
        //Split per line on tabs and commas
        var headers = allTextLines[0].split(/\t|,/);
        var lines = [];
        var locations = [];
        for (var i=1; i<allTextLines.length; i++) {
            var data = allTextLines[i].split(/\t|,/);
            
            if (data.length == headers.length) {
                                    
            var location = {"device_id":data[0], "address":data[1], "city":data[2]};
            locations.push(location);
            }
        }
        return locations;
    }
This way you can use a CSV that is copied into Excel. Excel will remove the seperators like , and others and will insert newlines etc.
With the my code you can pass everything into a textfield directly from Excel and then use that to create a json.
I have the naming of the fields static here, but you could use iwek's code to set the headers dynamically:
for(var j=0;j<headers.length;j++){
    obj[headers[j]] = currentline[j];
}