尝试将JSON导入R时发生R分析错误

问题描述

我有一个看起来像this

的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","abc_services_provided": "Painting","section": "on_relationships"
    },"text": "Gerrit: I thought the  ABC ..."
}
]