0
the Papa Parse module을 사용하여 CSV를 로컬 컴퓨터에서 JSON으로 변환합니다. 올바른 형식의 CSV를 JSON으로 변환 할 수 없습니다.
가이 코드 작성 : 대신 JSON 객체를 얻는,converted.json
에, 그러나
var fs = require('fs');
var Papa = require('papaparse');
var filePath = '../myCSVFile.csv';
Papa.parse(filePath, {
complete: function(results) {
fs.writeFile("./converted.json", JSON.stringify(results), function(err) {
if(err) {
return console.log(err);
}
console.log("finished!");
});
}
});
을,이 메시지가 나타납니다.
{"data":[["../myCSVFile.csv"]],"errors":[{"type":"Delimiter","code":"UndetectableDelimiter","message":"Unable to auto-detect delimiting character; defaulted to ','"}],"meta":{"delimiter":",", "linebreak":"\n","aborted":false,"truncated":false,"cursor":19}}
내 SV 파일의 형식이 올바른지 확신합니다. 내 코드에 문제가 있습니까?
'myCSVFile.csv'의 콘텐츠를 게시 할 수 있습니까? –