I'm trying to import a JSON file using the jsonlite library.
When I run the fromJSON function, I get the following error -
df <- fromJSON("Inputfile.json",flatten = TRUE)
Error in parse_con(txt, bigint_as_char) :
lexical error: invalid char in json text.
ÿþ[ (right here) ------^
Any suggestions for a workaround? Thanks
sessionInfo():
R version 4.0.1 RC (2020-05-30 r78643)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale: [1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
sessionInfo()and format your error accordingly?\0. (Can happen unexpectedly). If that's the case reading the file as texttxt <- scan(file)and removing those before reading it in as jsonfromJSON(gsub('\\0', '', txt))might fix it. I'm not the most experienced in this specific problem, so it might not work, but surely someone will pop in with a suggestion if this is the case.