Downloading JSON Data from a URL

Hi there,

I am relatively new to using R . I am trying to run the below code to download JSON Data from the url:


weather_url <- ''

res <- tryCatch({
}, error = function(e) {
  stop('failed to fetch json from url')

It allows me to run the weather URL, but when I try to run the tryCatch function, it gives the below error:

Error in value[[3L]](cond) : failed to fetch json from url

I am also receiving this message when running the tidyverse library:

── Attaching core tidyverse packages ──────────────────────────── tidyverse 2.0.0 ──
βœ” dplyr     1.1.0     βœ” readr     2.1.4
βœ” forcats   1.0.0     βœ” stringr   1.5.0
βœ” ggplot2   3.4.1     βœ” tibble    3.1.8
βœ” lubridate 1.9.2     βœ” tidyr     1.3.0
βœ” purrr     1.0.1     
── Conflicts ────────────────────────────────────────────── tidyverse_conflicts() ──
βœ– dplyr::filter() masks stats::filter()
βœ– dplyr::lag()    masks stats::lag()
β„Ή Use the conflicted package to force all conflicts to become errors
Warning message:
package β€˜tidyverse’ was built under R version 4.2.3 

I'm unsure if the problems with tidyverse package are causing the problems with downloading the data from the URL,

Could someone advise me on what to do?

should be

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.