首页 > 解决方案 > 使用 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"
    }

标签: r

解决方案


android 鳕鱼的一些问题,我检查了 json 格式是好的。这是检查 json 格式是否有效的参考链接。http://jsonviewer.stack.hu/


推荐阅读