我如何使用库csvjson将动态数组长度配置为json

时间:2019-04-11 22:02:39

标签: javascript node.js json csv

我使用库https://www.npmjs.com/package/csvjson将CSV转换为JSON,我们可以使用特定的符号转换对象数组,但是我需要配置它来转换对象的动态数组长度,我非常需要要完成的功能

 readFile('./test.csv', 'utf-8', (err, fileContent) => {
        if (err) {
            console.log(err); // Do something to handle the error or just throw it
            throw new Error(err);
        }
        const jsonObj = csvjson.toSchemaObject(fileContent);

        res.send(jsonObj)// to test res

    });

0 个答案:

没有答案