我有.log扩展名示例数据的JSON格式文件如下 “标题”:{ “ systemId”:“ WsCrgenstd_RTM_74”, “ sourceSystemType”:“自定义” }, “身体”: { “ systemId”:“ WsCrgenstd_RTM_74”, “ createTimestamp”:“ 1575284734366”, “ stringPoints”:[] } }
"header": {
"systemId": "WsCrgenstd_RTM_74",
"sourceSystemType": "CUSTOM"
},
"body": {
"systemId": "WsCrgenstd_RTM_74",
"createTimestamp": "1575284734631",
"stringPoints": []
}
}
"header": {
"systemId": "WsCrgenstd_RTM_74",
"sourceSystemType": "CUSTOM"
},
"body": {
"systemId": "WsCrgenstd_RTM_74",
"createTimestamp": "1575284735224",
"stringPoints": [
{
"name": "空调主机/电机线圈温度2/主机1",
"dataTimestamp": 1575284700000,
"value": "13.2599992752075",
"status": "OK",
"pointType": "STRING"
},
{
"name": "空调主机/电机线圈温度2/主机2",
"dataTimestamp": 1575284700000,
"value": "5.87747175411144E-39",
"status": "OK",
"pointType": "STRING"
}
]
}
}
"header": {
"systemId": "WsCrgenstd_RTM_74",
"sourceSystemType": "CUSTOM"
},
"body": {
"systemId": "WsCrgenstd_RTM_74",
"createTimestamp": "1575284735364",
"stringPoints": [
{
"name": "末端空调箱/风机运行状态/AHU_1_1",
"dataTimestamp": 1575284700000,
"value": "0",
"status": "OK",
"pointType": "STRING"
},
{
"name": "末端空调箱/风机运行状态/AHU_1_2",
"dataTimestamp": 1575284700000,
"value": "0",
"status": "OK",
"pointType": "STRING"
},
{
"name": "末端空调箱/风机运行状态/AHU_1_3",
"dataTimestamp": 1575284700000,
"value": "0",
"status": "OK",
"pointType": "STRING"
},
{
"name": "末端空调箱/风机运行状态/AHU_1_4",
"dataTimestamp": 1575284700000,
"value": "0",
"status": "OK",
"pointType": "STRING"
},
{
"name": "末端空调箱/风机运行状态/AHU_2_1",
"dataTimestamp": 1575284700000,
"value": "0",
"status": "OK",
"pointType": "STRING"
},
{
"name": "末端空调箱/风机运行状态/AHU_2_2",
"dataTimestamp": 1575284700000,
"value": "0",
"status": "OK",
"pointType": "STRING"
},
{
"name": "末端空调箱/风机运行状态/AHU_2_3",
"dataTimestamp": 1575284700000,
"value": "0",
"status": "OK",
"pointType": "STRING"
},
{
"name": "末端空调箱/风机运行状态/AHU_2_4",
"dataTimestamp": 1575284700000,
"value": "0",
"status": "OK",
"pointType": "STRING"
}
]
}
}
所示
答案 0 :(得分:0)
您可以使用下面的代码,这将有助于将Json转换为csv文件。 我不确定您在此处发布的内容是否是确切的json。 但一定会有帮助。
d1 <- fromJSON(r1,simplifyVector = TRUE)
write.csv(d1,'mydata.csv',rows.name=F)
其中r1是您的json文件 d1是您的数据框, 最终的csv文件是mydata,如果执行命令write.csv,它可以保存在目录中。