JSON Response Using Retrofit on Android
<p>I'm able to get JSON response using OkHttp3, and I want to use Retrofit to parse the response to get the name and the image from it. I looked into Retrofit website and some tutorials, but still the process not clear.</p>

<p>Here is my OkHttp3 code to get JSON response:</p>

<pre><code> Request request = new Request.Builder().url(url).build();

    client.newCall(request).enqueue(new Callback() {
        @Override
        public void onFailure(Call call, IOException e) {
            e.printStackTrace();

        }

        @Override
        public void onResponse(Call call, Response response) throws IOException {
            if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);

            Headers responseHeaders = response.headers();
            for (int i = 0, size = responseHeaders.size(); i &lt; size; i++) {
                System.out.println(responseHeaders.name(i) + responseHeaders.value(i));
            }
            System.out.println(response.body().string());
            String jData = response.body().string();// I want to parse jData using Retrofit

        }
    });
</code></pre>

<p>The JSON response looks like this:</p>

<p><a href="https://i.stack.imgur.com/vWU2K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vWU2K.png" alt="enter image description here"></a></p>

<p>I want to get the name, id, and the image of each artist, any help is greatly appreciated. </p>

<p><strong>UPDATE</strong></p>

<p>I added Pojo classes one of them is Item class:</p>

<pre><code>public class Item {

@SerializedName("external_urls")
@Expose
private ExternalUrls externalUrls;
@SerializedName("followers")
@Expose
private Followers followers;
@SerializedName("genres")
@Expose
private List&lt;Object&gt; genres = new ArrayList&lt;Object&gt;();
@SerializedName("href")
@Expose
private String href;
@SerializedName("id")
@Expose
private String id;
@SerializedName("images")
@Expose
private List&lt;Object&gt; images = new ArrayList&lt;Object&gt;();
@SerializedName("name")
@Expose
private String name;
@SerializedName("popularity")
@Expose
private Integer popularity;
@SerializedName("type")
@Expose
private String type;
@SerializedName("uri")
@Expose
private String uri;

/**
 *
 * @return
 * The externalUrls
 */
public ExternalUrls getExternalUrls() {
    return externalUrls;
}

/**
 *
 * @param externalUrls
 * The external_urls
 */
public void setExternalUrls(ExternalUrls externalUrls) {
    this.externalUrls = externalUrls;
}

/**
 *
 * @return
 * The followers
 */
public Followers getFollowers() {
    return followers;
}

/**
 *
 * @param followers
 * The followers
 */
public void setFollowers(Followers followers) {
    this.followers = followers;
}

/**
 *
 * @return
 * The genres
 */
public List&lt;Object&gt; getGenres() {
    return genres;
}

/**
 *
 * @param genres
 * The genres
 */
public void setGenres(List&lt;Object&gt; genres) {
    this.genres = genres;
}

/**
 *
 * @return
 * The href
 */
public String getHref() {
    return href;
}

/**
 *
 * @param href
 * The href
 */
public void setHref(String href) {
    this.href = href;
}

/**
 *
 * @return
 * The id
 */
public String getId() {
    return id;
}

/**
 *
 * @param id
 * The id
 */
public void setId(String id) {
    this.id = id;
}

/**
 *
 * @return
 * The images
 */
public List&lt;Object&gt; getImages() {
    return images;
}

/**
 *
 * @param images
 * The images
 */
public void setImages(List&lt;Object&gt; images) {
    this.images = images;
}

/**
 *
 * @return
 * The name
 */
public String getName() {
    return name;
}

/**
 *
 * @param name
 * The name
 */
public void setName(String name) {
    this.name = name;
}

/**
 *
 * @return
 * The popularity
 */
public Integer getPopularity() {
    return popularity;
}

/**
 *
 * @param popularity
 * The popularity
 */
public void setPopularity(Integer popularity) {
    this.popularity = popularity;
}

/**
 *
 * @return
 * The type
 */
public String getType() {
    return type;
}

/**
 *
 * @param type
 * The type
 */
public void setType(String type) {
    this.type = type;
}

/**
 *
 * @return
 * The uri
 */
public String getUri() {
    return uri;
}

/**
 *
 * @param uri
 * The uri
 */
public void setUri(String uri) {
    this.uri = uri;
}
</code></pre>

<p>}</p>

<p>Here how I'm using Retrofit in my activity:</p>

<pre><code>    private void loadJSON() {
    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl("https://api.spotify.com")
            .addConverterFactory(GsonConverterFactory.create())
            .build();
    final Artists_Interface request = retrofit.create(Artists_Interface.class);

    Call&lt;Item&gt; call = request.getArtists();
    call.enqueue(new Callback&lt;Item&gt;() {
        @Override
        public void onResponse(Call&lt;Item&gt; call, Response&lt;Item&gt; response) {
            if(response.isSuccessful()){
                Item artist = response.body();
                System.out.println("THE NAME::::. : " + artist.getName());
            }
            else{
                System.out.println(" :::. NOO RESPONSE .::: " );
            } 
        }

        @Override
        public void onFailure(Call&lt;Item&gt; call, Throwable t) {
            System.out.println("onFAIL::: " + t);
        }
    });
</code></pre>

<p>And here how the retrofit interface look like:</p>

<pre><code>public interface Artists_Interface {

@GET("/v1/search?q=Beyonce&amp;type=artist")
Call&lt;Item&gt; getArtists();
</code></pre>

<p>}</p>

<p>I get artist.getName() equals null. I need to get into name, id, and images that are inside "items" in JSON body and pass them to listView or recyclerView adapter</p>