I am making a client side program to convert a CSV to JSON. I have tried following along to this solution here but I can't quite get what I want. I want to save the JSON to a variable to that I can add headers and do other manipulations to the JSON file.
import csv from 'csv';
handleFiles = () => {
console.log(this.refs.file.files[0])
var reader = new FileReader();
reader.onload = ()=> {
let jsonfile = reader.readAsBinaryString(this.refs.file.files[0]);
}
}
when I console log jsonfile it is undefined. I am trying to get my data into an array of objects or an array of arrays.