从Json到数据框或R中的csv

时间:2018-03-16 16:55:30

标签: json r

我试图用R中的fromJSON转换这个json文件而且我不能

{"data":[
{"id_str": "972985896999014403", "created_at": "Mon Mar 12 00:01:29 +0000 2018", "text": "One week later, and Ryan Seacrest\u2019s weird #Oscars night is still with ", "name": "680 CJOB", "screen_name": "680CJOB"}}, ........

我的代码:

json_data<-fromJSON(file="input.json")
Error in fromJSON(file = "input.json") : 
  argument "txt" is missing, with no default

1 个答案:

答案 0 :(得分:0)

您只有fromJSON的参数名称错误。它应该是txt或者,因为它是第一个未命名的:

json_data <- fromJSON(txt = "input.json")

# also works
json_data <- fromJSON("input.json")