尝试将 JSON 导入 R 时出现 R 解析错误
R Parsing error when trying to import JSON to R
我有一个 JSON 文件,看起来像 this
我正在尝试使用 jsonlite
包将其导入 R。
#Load package for import
library(jsonlite)
df <- fromJSON("test.json")
但是它抛出一个错误
Error in parse_con(txt, bigint_as_char) : parse error: trailing
garbage
ome in at a later time." } { "id": "e5fa37f44557c62ee
(right here) ------^
我已经尝试查看 Whosebug 上的所有解决方案,但一直无法弄清楚。
任何意见都会很有帮助。
您链接的 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 ..."
}
]
我有一个 JSON 文件,看起来像 this
我正在尝试使用 jsonlite
包将其导入 R。
#Load package for import
library(jsonlite)
df <- fromJSON("test.json")
但是它抛出一个错误
Error in parse_con(txt, bigint_as_char) : parse error: trailing garbage ome in at a later time." } { "id": "e5fa37f44557c62ee (right here) ------^
我已经尝试查看 Whosebug 上的所有解决方案,但一直无法弄清楚。
任何意见都会很有帮助。
您链接的 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 ..."
}
]