Code example for Gson

Methods: fromJson

0
    public EuropeanaResults searchPage(EuropeanaQuery search, long startPage)
            throws IOException { 
        String json = this.searchJsonPage(search, startPage);
 
        // Load results object from JSON 
        Gson gson = new Gson();
 
        return gson.fromJson(json, EuropeanaResults.class);
    } 
 
    public String searchJsonPage(EuropeanaQuery search, long startPage)
            throws IOException { 
        String cadenaBusq = search.getQueryString();
        String url = this.europeanaUri + "?searchTerms=" + URLEncoder.encode(cadenaBusq, "UTF-8");
        url += "&startPage=" + startPage;
        url += "&wskey=" + this.apiKey;
 
        // Execute Europeana API request 
        String jSON = this.getJSONResult(url);