r - 使用 R 解析复杂的 json 数据时出错
问题描述
使用 R 解析 json 数据以读取为数据框
library(jsonlite)
result <- fromJSON("2018-12-27_Execution.json",flatten=FALSE)
出现错误,例如:
parse_con(txt, bigint_as_char) 中的错误:解析错误:尾随垃圾 12:02:45.5385 Info { "message" (right here) ------^
我的数据看起来像这样......
12:02:45.5385 Info {
"message": "Mouse and Keyboard execution started",
"level": "Information",
"logType": "Default",
"timeStamp": "2018-12-26T12:02:45.5050962+05:30",
"fingerprint": "54add266-e135-4cdd-b89c-36bce3e9a089",
"windowsIdentity": "DESKTOP-D2258GK\\Rahul Arora",
"machineName": "DESKTOP-D2258GK",
"processName": "Mouse and Keyboard",
"processVersion": "1.0.0.0",
"jobId": "07736e9d-b1c3-4529-9bd7-a5255d2eaa98",
"robotName": "RAHUL ARORA",
"machineId": 0,
"fileName": "Main"
}12:02:50.9663 Info {
"message": "Mouse and Keyboard execution ended",
"level": "Information",
"logType": "Default",
"timeStamp": "2018-12-26T12:02:50.9663451+05:30",
"fingerprint": "cc748786-c960-4f46-9b07-b1d13c395a4f",
"windowsIdentity": "DESKTOP-D2258GK\\Rahul Arora",
"machineName": "DESKTOP-D2258GK",
"processName": "Mouse and Keyboard",
"processVersion": "1.0.0.0",
"jobId": "07736e9d-b1c3-4529-9bd7-a5255d2eaa98",
"robotName": "RAHUL ARORA",
"machineId": 0,
"totalExecutionTimeInSeconds": 5,
"totalExecutionTime": "00:00:05",
"fileName": "Main"
}
解决方案
android 鳕鱼的一些问题,我检查了 json 格式是好的。这是检查 json 格式是否有效的参考链接。http://jsonviewer.stack.hu/
推荐阅读
- javascript - ReactJS / JavaScript:在许多情况下未收到调整大小事件
- python - 在不使用 for 循环的情况下将值应用于 DataFrame
- uima - 使用 UIMA Ruta:如何注释文本的第一个标记并进一步使用该注释?
- android - Android服务不断停止-“不允许后台执行:接收意图”
- angular - Angular Pipe 返回值,但 ngFor 不会显示它们
- php - 除 root 以外的所有用户的 MySQL 访问被拒绝
- php - 如何在 TPL 文件中的 prestashop 1.7 中检测 smarty 中的设备?
- angular - Angular 7 测试用例抛出广播错误
- php - S3 CreateEventSourceMapping 触发“找不到操作”错误
- makefile - 空运行 Makefile,当“没有任何事情要为‘所有’做”时