r - 尝试将 JSON 导入 R 时出现 R 解析错误
问题描述
我有一个看起来像这样的 JSON 文件
我正在尝试使用jsonlite
包将其导入 R。
#Load package for import
library(jsonlite)
df <- fromJSON("test.json")
但它会引发错误
parse_con(txt, bigint_as_char) 中的错误:解析错误:稍后会出现尾随垃圾。" } { "id": "e5fa37f44557c62ee (就在这里) ------^
我已经尝试查看 stackoverflow 上的所有解决方案,但无法弄清楚这一点。
任何输入都会非常有帮助。
解决方案
您链接的 JSON 文件包含两个JSON 对象。也许你想要一个数组:
[
{
"id": "71bb8883780bb152e4bb4db976bedc62",
"metadata": {
"abc_bad_date": "true",
"abc_client": "Hydra Corp",
"abc_doc_id": 1,
"abc_file": "Hydra Corp 2016.txt",
"abc_interview_type": "Post Analysis",
"abc_interviewee_role": "Director Corporate Engineering; Greater Chicago Area; Global Procurement Director Facilities and MRO",
"abc_interviewer": "Piper Thomas",
"abc_services_provided": "Food",
"section": "on_expectations"
},
"text": "Gerrit: There were a number ...."
},
{
"id": "e5fa37f44557c62eef44baafb13128f0",
"metadata": {
"abc_bad_date": "true",
"abc_client": "Hydra Corp",
"abc_doc_id": 1,
"abc_file": "Hydra Corp 2016.txt",
"abc_interview_type": "Post Analysis",
"abc_interviewee_role": "Director Corporate Engineering; Greater Chicago Area; Global Procurement Director Facilities and MRO",
"abc_interviewer": "Piper Thomas",
"abc_services_provided": "Painting",
"section": "on_relationships"
},
"text": "Gerrit: I thought the ABC ..."
}
]
推荐阅读
- ios - After Transferred IOS App], No profile for 'xxxxxxxxxxxxxx' was found Xcode
- android - 清单合并失败错误,还有两个同步模块
- python - python: from __future__ import print_function 必须在每个加载的模块中?
- javascript - 在 JavaScript 中编写“array.length - 1”的更好方法是什么?
- css - 如何为 tabulator-bulma.css 添加边框?
- regex - sed 仅修改文件中的第一列,但如果匹配则不修改第一次出现
- ios - 如何创建橡皮筋效果?
- rest - 一段时间后在 HTTP POST 请求上出现 I/O 错误
- delphi-7 - virtualtreeview 以编程方式移动选择栏(响应向下/向上键)
- kubernetes - GKE pod 未连接到 Cloudsql