Getting data from JSON file in R

前端 未结 1 1514
南方客
南方客 2021-01-03 07:07

Lets say that I have the following json file:

{
  \"id\": \"000018ac-04ef-4270-81e6-9e3cb8274d31\",
   \"currentCompany\": \"\",
   \"currentTitle\": \"--\",         


        
1条回答
  •  再見小時候
    2021-01-03 07:40

    Surprised this was never answered! Using the jsonlite package, you can collapse your json data into one character element using paste(x, collapse="") removing EOF markers for proper import into an R dataframe. I, too, faced a pretty-printed json with exact error:

    library(jsonlite)
    
    json <- do.call(rbind, 
                    lapply(paste(readLines(Usersfile, warn=FALSE),
                                 collapse=""), 
                           jsonlite::fromJSON))
    

    0 讨论(0)
提交回复
热议问题