[英]How to convert plain set of data from the file into json format
我在單獨的行中有一些普通的機器學習數據集,如下所示:
vhigh,vhigh,2,4,small,low,unac
vhigh,vhigh,2,4,small,med,unac
vhigh,vhigh,3,more,med,low,unac
... 上面還有 1700 多行
我想將數據轉換成這樣的結構:
[
{
"buying": "vhigh",
"maint": "vhigh",
"doors": "2",
"persons": "2",
"lug_boot": "small",
"safety": "low",
"evaluation": "unacc"
},
{
"buying": "vhigh",
"maint": "vhigh",
"doors": "2",
"persons": "2",
"lug_boot": "small",
"safety": "med",
"evaluation": "unacc"
},
...
]
並將轉換后的數據保存到新的 file.json 中
#edit : Node.js 運行時
我找到了答案。 感謝您針對 csv。 在這里使用轉換工具就足夠了: https : //csvjson.com/csv2json
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.