2

Issue

I get the following error whenever I run

all_companies <- jsonlite::fromJSON("https://www.sec.gov/files/company_tickers_exchange.json")
Warning: URL 'https://www.sec.gov/files/company_tickers_exchange.json': status was 'SSL connect error'Error in open.connection(con, "rb") : 
  cannot open the connection to 'https://www.sec.gov/files/company_tickers_exchange.json'

Thank you in advance for any help!

What I've tried

I am trying to run this on a new work computer, it runs fine on my old work computer but the new one gives me this error.

  • It seems the difference causing this issue is that I am using {jsonlite} 1.8.2 on my new computer and 1.8.0 on my old computer. Deep in the definition of the fromJSON() function, the working version seems to use curl::curl() to establish a connection whereas the not-working version uses base::url().

  • The following example line from the help documentation runs fine on the new computer with version 1.8.2

data1 <- fromJSON("https://api.github.com/users/hadley/orgs")
  • I can access the JSON file I am trying to read on an internet browser.

  • I do not have permission to install Rtools on my computer to be able to compile an older version of {jsonlite}.

  • I can run the command just fine on my computer, so I can't help diagnose your issue. Why don't you download the file first and then parse it afterwards? Within R you can use `download.file`. – robertdj Feb 11 '23 at 19:13
  • Thank you for your response. Looks like I'm having a similar issue with trying to download it. I tried the following: `# Create temporary directory temp_dir <- tempdir() # Get all company ciks all_companies <- download.file("https://www.sec.gov/files/company_tickers_exchange.json", destfile = paste0(temp_dir, "\\", "all_companies.json"), method = "libcurl")` `Error in download.file("{link above}", : cannot open URL In addition: Warning message: status was 'SSL connect error'` – Philli Phresh Feb 12 '23 at 17:24

0 Answers0