Parsing error in jsonlite reading multiple validated json files in R

401 Views Asked by At

I'm new to json files in R. I got some json files for STONKS are you can see scraped online. The werid thing is each individual json file can be read perfectly using fromJSON from the jsonlite library. I have taken individual files to check on jsonlint.com to validate, and the web confirmed they are valid json files.

I have tried to use the validate () from jsonlite on single files, but there the file failed to pass the validation.

However, when I want to use lapply to read all the files R gave me error on

Error in parse_con(txt, bigint_as_char) : 
  lexical error: invalid char in json text.
                                   No data available for the given

Here are my simple codes:

library(tidyr)
library(jsonlite)

ls <- list.files(pattern = "*.json")

Data.fromJson <- lapply(ls, fromJSON)

Sorry but I think the problem might be with the data so I dont want to just trim it and make dummy as it might mess things up. Instead I have uploaded a few json files to my google drive and here is the link:

https://drive.google.com/drive/folders/1zM4vj1TIseFKBSiNWe5yMY9BJPg-CIsv?usp=sharing

0

There are 0 best solutions below