I'm trying scrape this url and store onto a dataframe, however I can't seem to be able to parse this? I tried several other post but so far it as failed.
tryCatch(
{
json_data <- read_html(glue ( "https://coinmarketcap.com/historical/20210917" )) %>%
html_node("#__NEXT_DATA__") %>%
html_text() %>%
fromJSON()
}, error=function(e){}
) -> json_data
fromJSON(json_data) %>% as.data.frame #failed
fromJSON(json_data$props) %>% as.data.frame #failed
fromJSON(json_data$props) %>% as.data.frame #failed
edit: I think I found the nested text I need but the json structure looks really messed up?
> str ( json_data$props$initialState )
chr "{\"app\":{\"locale\":\"en-US\",\"theme\":\"DAY\",\"lang\":\"en\",\"country\":\"\",\"currency\":{\"id\":2781,\"n"| __truncated__
>
Converting nested JSON to data frame Converting nested JSON file to R dataframe Converting a nested JSON to transformed dataframe in R Json read and convert to dataframe