title: reading a list using Get method on external API (REST)(java)
body: <p>Im trying to learn how to consume a REST webservice using Jersey. Im using a get request to view data from the URI "<a href="https://api.fixer.io/latest" rel="nofollow noreferrer">https://api.fixer.io/latest</a>" this URI displays a base, date and i believe a array/ArrayList. In my class below, i have managed to display the date and base of the resource. But I am having trouble displaying the list of items. When i run my code it gives this:</p>
  
  <p>Date = 2017-12-15, base = EURlist = []</p>
  
  <p>an example of what im looking for would be:</p>
  
  <p>Date = 2017-12-15, base = EUR list = [AUD":1.5382,"BGN":1.9558 (etc)]</p>
  
  <p>Here is my code: 
  restServiceClient.java</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  import javax.ws.rs.client.Client;
  import javax.ws.rs.client.ClientBuilder;
  import javax.ws.rs.client.Entity;
  import javax.ws.rs.client.WebTarget;
  import javax.ws.rs.core.MediaType;
  import javax.xml.ws.Response;
  
  public class restServiceClient{
  
  
  public static void main(String[] args) {
  
      Client client = ClientBuilder.newClient();
  Exchange exchange = client.target("https://api.fixer.io/latest")
                        .request(MediaType.APPLICATION_XML)
                        .get(Exchange.class);
  
  
  String base = exchange.getBase();
  String date = exchange.getDate();
  ArrayList&lt;String&gt; theList = exchange.getRates();
  
  //String[] excArray = theList.toArray();
  System.out.print(exchange);
  
  client.close() ;
  }
  
  }
  </code></pre>
  
  <p>Exchange.java</p>
  
  <pre><code>import java.lang.reflect.Array;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.List;
  
  /*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  
  /**
   *
   * @author Admin
   */
  public class Exchange {
      private String base;
      private String date;
      private ArrayList&lt;String&gt; rates;
  
      public ArrayList&lt;String&gt; getRates() {
          return rates;
      }
  
      public void setRates(ArrayList&lt;String&gt; rates) {
          this.rates = rates;
      }
  
      public void setBase(String base) {
          this.base = base;
      }
  
      public void setDate(String date) {
          this.date = date;
      }
  
  
  
      public String getBase() {
          return base;
      }
  
      public String getDate() {
          return date;
      }
  
  
  
    @Override
  public String toString() {
      return "Date = " + date + ", base = "
              + base + " list = " + rates;
  }
  
  }
  </code></pre>