Argument "txt" is missing (without default value) Convert JSON file

864 Views Asked by At

I have a question about an R Markdown file. I want to convert a JSON file into a data frame, and I use the following code:

```{r}
install.packages("jsonlite")
library(rjson)
install.packages("rjson")
library(jsonlite)
```

```{r}
dfjson <- fromJSON(file= "/Users/sarah/JSON/fhir_dstu2/Aaron697_Stiedemann542_41166989-975d-4d17-b9de-17f94cb3eec1.json")
dfjson
str(dfjson)
```

```{r}
print(dfjson)
```

The problem is that as soon as I run the second chunk, I get the error message:

Error in fromJSON(file = "/Users/sarah/JSON/fhir_dstu2/Aaron697_Stiedemann542_41166989-975d-4d17-b9de-17f94cb3eec1.json") : 
  Argument "txt" is missing (without default value)

I don't understand what could be wrong. Do you guys have a solution for me?

Thanks already

1

There are 1 best solutions below

0
Ziyang Yang On

Yes agree SymbolixAU's reply. Change 'file=' to 'tet=' and then it will automatically show the data as a dataframe.