Recursively parsing JSON response using GSON
Have the following POJOs

class Result {
    private String resourceId;
}

class Next{
    private String url;
}

class Response{
    private boolean hasMore;
    private List&lt;Result&gt; result;
    private Next next;
}
// If other fields are required add them.
// Have their getters/setters.
// Have the hashCode,equals,toString


Your getListOfIps() could look like this:

List&lt;String&gt; ips = new ArrayList&lt;String&gt;();
Response response = null;
String url = getURL(alias);
do{
    String responseJson = getJsonResponse(url);
    try{
        response = new Gson().fromJson(responseJson , Response.Class);
    } catch( // Json Exceptions thrown by this function){
        // Log the exception and handle it .
    }
    // Check if response and response.result is non null
    // Loop through and extract the non-null resourceId
    // update url
    if(response.hasMore &amp;&amp; (response.next!=null) &amp;&amp; (response.next.url.length()&gt;0)){
        url= response.next.url;
    }else{
        url = null;
    }
  } while(url);


The code is more of a "steps to follow". Hope it helps. 
Try the code and you can post the updated code if its better. 
For Gson help follow this link.