1

I am having issues importing a JSON file into R

Below is the code

library(RJSON)
json_file <- "file_path"
json_data <-fromJSON(file=json_file)

Which returns - Error in fromJSON(file = json_file) : unexpected character '<ef>'

which i suspect is due to the unicode / hashtag as the JSON file contains hex codes e.g #000000.
If i remove the # and replace it with %23 the file will load correctly.

how do i properly load the JSON file, i do not want to manually replace the "#" as i have thousands of these files.

An idea would be to use REGEX to replace # with %23, however i am not too sure how to do that.

Does anyone have any suggestions?

Vine
  • 395
  • 3
  • 13

0 Answers0