我想转换具有值数组的 json。 响应.json
{
"rows": [
[
"New Visitor",
"(not set)",
"(not set)",
"0"
],
[
"New Visitor",
"(not set)",
"(not set)",
"mobile"
],
[
"New Visitor",
"(not set)",
"(not set)",
"mobile"
],
[
"New Visitor",
"(not set)",
"(not set)",
"mobile",
]
]
}
现在我想把这些数据转换成。 名称.csv
"New Visitor","(not set)","(not set)","0"
"New Visitor","(not set)","(not set)","mobile"
"New Visitor","(not set)","(not set)","mobile"
"New Visitor","(not set)","(not set)","mobile"
请给我使用 Node.js 的建议。
原文由 arjun kori 发布,翻译遵循 CC BY-SA 4.0 许可协议
像这样自己做:
使用库
前任。 https://github.com/mrodrig/json-2-csv , https://github.com/wdavidw/node-csv , https://github.com/wdavidw/node-csv-stringify
使用 json-2-csv ( https://github.com/mrodrig/json-2-csv ) 的示例
使用 csv-stringify 的示例( https://github.com/wdavidw/node-csv-stringify )