score:1

Accepted answer
 //the call to webclient.downloadstring(string) will throw an exception if the 
 //uri does not exist, in your case, the json file does not exist
 var alltext = null;
 object jsonobject = null;

 try
 {
     alltext = (new webclient()).downloadstring(uripath);
     jsonobject = jsonconvert.deserializeobject(alltext);
 }
 catch(webexception ex)
 {
     jsonobject = new object[0];
 } 

score:0

icollection<int> readnumbersfromwebclient(int code)
{
    // in case of exception: return empty string
    try
    {
        string uripath = "http://mystorage.com/folder/" + code + ".json";
        var downloadedtext = downloadtext(uripath);
        return jsonconvert.deserializeobject<int[]>(alltext);
    }
    catch (exception exc) // or use specific exception
    {
        return new int[];
    }
}

Related Query

More Query from same tag