I'm using R to obtain json files from a website. In particular, I'm using the fromJSON function of the RJSONIO package. I'm trying to get json files from 50,000 website links. However, some of them might not be valid API links. Right now, I'm using for loop to get the json files. However, each time I encounter an invalid link, the whole program comes to a halt.
How can I just pass to the next iteration if I encounter invalid API links?