[英]How to convert plain set of data from the file into json format
I have some plain machine learnig data set in separate lines like this:我在单独的行中有一些普通的机器学习数据集,如下所示:
vhigh,vhigh,2,4,small,low,unacc vhigh,vhigh,2,4,small,low,unac
vhigh,vhigh,2,4,small,med,unacc vhigh,vhigh,2,4,small,med,unac
vhigh,vhigh,3,more,med,low,unacc vhigh,vhigh,3,more,med,low,unac
... 1700 more lines like above ... 上面还有 1700 多行
I want to convert data into structure like this:我想将数据转换成这样的结构:
[
{
"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"
},
...
]
and save converted data into new file.json并将转换后的数据保存到新的 file.json 中
#edit : Node.js runtime #edit : Node.js 运行时
I found the answer.我找到了答案。 Thank you for targeting the csv.
感谢您针对 csv。 It was enough to use the conversion tool here: https://csvjson.com/csv2json
在这里使用转换工具就足够了: https : //csvjson.com/csv2json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.