csv 转 json
Github https://github.com/mholt/PapaParse
Npm https://www.npmjs.com/package/papaparse
网站 https://www.papaparse.com
// pnpm add papaparse
// Parse CSV string
const data = Papa.parse(csvString, config);
// Convert back to CSV
const csv = Papa.unparse(data);
// Parse local CSV file
Papa.parse(file, {
complete: function(results) {
console.log("Finished:", results.data);
}
});
// Stream big file in worker thread
Papa.parse(bigFile, {
worker: true,
step: function(results) {
console.log("Row:", results.data);
}
});
在线案例
https://www.papaparse.com/demo
d3-dsv
https://github.com/d3/d3-dsv
csv转 d3 json