title: Can't retrieve key/value pairs from API using Retrofit
body: <p>I need to display key (currency)/value pairs that I have got from API such as a short name of currency, and its value. Unfortunately when I am trying to get any value of my Model class, it's showing me null. How can I solve that?</p>
  
  <p>API that I am using is <a href="https://api.exchangeratesapi.io/" rel="nofollow noreferrer">https://api.exchangeratesapi.io/</a></p>
  
  <p>Data that I should receive looks like that</p>
  
  <pre><code>{
    "base": "EUR",
    "rates": {
      "BGN": 1.9558,
      "NZD": 1.7025,
      "ILS": 4.0004,
      "RUB": 73.3493,
      "CAD": 1.5132,
      "USD": 1.123,
      "PHP": 58.722,
      "CHF": 1.1378,
      "ZAR": 15.9762,
      "AUD": 1.6059,
      "JPY": 123.25,
      "TRY": 6.8837,
      "HKD": 8.8135,
      "MYR": 4.6781,
      "THB": 35.464,
      "HRK": 7.409,
      "NOK": 9.8193,
      "IDR": 16177.38,
      "DKK": 7.4658,
      "CZK": 25.732,
      "HUF": 323.52,
      "GBP": 0.8625,
      "MXN": 21.5589,
      "KRW": 1325.32,
      "ISK": 137.0,
      "SGD": 1.5305,
      "BRL": 4.4405,
      "PLN": 4.296,
      "INR": 78.6075,
      "RON": 4.7598,
      "CNY": 7.6628,
      "SEK": 10.8108
    },
    "date": "2019-05-10"
  }
  </code></pre>
  
  <p>MainActivity:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      TextView textView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          textView = findViewById(R.id.label);
  
          Retrofit retrofit = new Retrofit.Builder()
                  .baseUrl("https://api.exchangeratesapi.io/")
                  .addConverterFactory(GsonConverterFactory.create())
                  .build();
  
          Api api = retrofit.create(Api.class);
          Call&lt;Model.Rates&gt; call = api.getRates();
  
          call.enqueue(new Callback&lt;Model.Rates&gt;() {
              @Override
              public void onResponse(Call&lt;Model.Rates&gt; call, Response&lt;Model.Rates&gt; response) {
                  if (!response.isSuccessful()){
                      textView.setText(response.code());
                      return;
                  }
  
                  List&lt;Model.Rates&gt; ratesList = Collections.singletonList(response.body());
  
                  for (Model.Rates model : ratesList){
                      String content = "";
                      content += "First "+model.getCAD()+"\n\n\n";
                      textView.append(content);
                  }
              }
  
              @Override
              public void onFailure(Call&lt;Model.Rates&gt; call, Throwable t) {
                  textView.setText(t.getMessage());
              }
          });
      }
  }
  </code></pre>
  
  <p>Model class:</p>
  
  <pre><code>public class Model {
  
      private String date;
  
      public Rates rates;
  
      private String base;
  
      private String currencyNationality;
      private String currencyValue;
  
      public Model(String currencyNationality, String currencyValue) {
          this.currencyNationality = currencyNationality;
          this.currencyValue = currencyValue;
      }
  
      public String getCurrencyNationality() {
          return currencyNationality;
      }
  
      public void setCurrencyNationality(String currencyNationality) {
          this.currencyNationality = currencyNationality;
      }
  
      public String getCurrencyValue() {
          return currencyValue;
      }
  
      public void setCurrencyValue(String currencyValue) {
          this.currencyValue = currencyValue;
      }
  
      public String getDate() {
          return date;
      }
  
      public void setDate(String date) {
          this.date = date;
      }
  
      public Rates getRates() {
          return rates;
      }
  
      public void setRates(Rates rates) {
          this.rates = rates;
      }
  
      public String getBase() {
          return base;
      }
  
      public void setBase(String base) {
          this.base = base;
      }
  
      class Rates {
  
          private String CHF;
  
          private String HRK;
  
          private String MXN;
  
          private String ZAR;
  
          private String INR;
  
          private String THB;
  
          private String CNY;
  
          private String AUD;
  
          private String ILS;
  
          private String KRW;
  
          private String JPY;
  
          private String PLN;
  
          private String GBP;
  
          private String IDR;
  
          private String HUF;
  
          private String PHP;
  
          private String TRY;
  
          private String RUB;
  
          private String HKD;
  
          private String ISK;
  
          private String DKK;
  
          private String CAD;
  
          private String USD;
  
          private String MYR;
  
          private String BGN;
  
          private String NOK;
  
          private String RON;
  
          private String SGD;
  
          private String CZK;
  
          private String SEK;
  
          private String NZD;
  
          private String BRL;
  
          public String getCHF() {
              return CHF;
          }
  
          public void setCHF(String CHF) {
              this.CHF = CHF;
          }
  
          public String getHRK() {
              return HRK;
          }
  
          public void setHRK(String HRK) {
              this.HRK = HRK;
          }
  
          public String getMXN() {
              return MXN;
          }
  
          public void setMXN(String MXN) {
              this.MXN = MXN;
          }
  
          public String getZAR() {
              return ZAR;
          }
  
          public void setZAR(String ZAR) {
              this.ZAR = ZAR;
          }
  
          public String getINR() {
              return INR;
          }
  
          public void setINR(String INR) {
              this.INR = INR;
          }
  
          public String getTHB() {
              return THB;
          }
  
          public void setTHB(String THB) {
              this.THB = THB;
          }
  
          public String getCNY() {
              return CNY;
          }
  
          public void setCNY(String CNY) {
              this.CNY = CNY;
          }
  
          public String getAUD() {
              return AUD;
          }
  
          public void setAUD(String AUD) {
              this.AUD = AUD;
          }
  
          public String getILS() {
              return ILS;
          }
  
          public void setILS(String ILS) {
              this.ILS = ILS;
          }
  
          public String getKRW() {
              return KRW;
          }
  
          public void setKRW(String KRW) {
              this.KRW = KRW;
          }
  
          public String getJPY() {
              return JPY;
          }
  
          public void setJPY(String JPY) {
              this.JPY = JPY;
          }
  
          public String getPLN() {
              return PLN;
          }
  
          public void setPLN(String PLN) {
              this.PLN = PLN;
          }
  
          public String getGBP() {
              return GBP;
          }
  
          public void setGBP(String GBP) {
              this.GBP = GBP;
          }
  
          public String getIDR() {
              return IDR;
          }
  
          public void setIDR(String IDR) {
              this.IDR = IDR;
          }
  
          public String getHUF() {
              return HUF;
          }
  
          public void setHUF(String HUF) {
              this.HUF = HUF;
          }
  
          public String getPHP() {
              return PHP;
          }
  
          public void setPHP(String PHP) {
              this.PHP = PHP;
          }
  
          public String getTRY() {
              return TRY;
          }
  
          public void setTRY(String TRY) {
              this.TRY = TRY;
          }
  
          public String getRUB() {
              return RUB;
          }
  
          public void setRUB(String RUB) {
              this.RUB = RUB;
          }
  
          public String getHKD() {
              return HKD;
          }
  
          public void setHKD(String HKD) {
              this.HKD = HKD;
          }
  
          public String getISK() {
              return ISK;
          }
  
          public void setISK(String ISK) {
              this.ISK = ISK;
          }
  
          public String getDKK() {
              return DKK;
          }
  
          public void setDKK(String DKK) {
              this.DKK = DKK;
          }
  
          public String getCAD() {
              return CAD;
          }
  
          public void setCAD(String CAD) {
              this.CAD = CAD;
          }
  
          public String getUSD() {
              return USD;
          }
  
          public void setUSD(String USD) {
              this.USD = USD;
          }
  
          public String getMYR() {
              return MYR;
          }
  
          public void setMYR(String MYR) {
              this.MYR = MYR;
          }
  
          public String getBGN() {
              return BGN;
          }
  
          public void setBGN(String BGN) {
              this.BGN = BGN;
          }
  
          public String getNOK() {
              return NOK;
          }
  
          public void setNOK(String NOK) {
              this.NOK = NOK;
          }
  
          public String getRON() {
              return RON;
          }
  
          public void setRON(String RON) {
              this.RON = RON;
          }
  
          public String getSGD() {
              return SGD;
          }
  
          public void setSGD(String SGD) {
              this.SGD = SGD;
          }
  
          public String getCZK() {
              return CZK;
          }
  
          public void setCZK(String CZK) {
              this.CZK = CZK;
          }
  
          public String getSEK() {
              return SEK;
          }
  
          public void setSEK(String SEK) {
              this.SEK = SEK;
          }
  
          public String getNZD() {
              return NZD;
          }
  
          public void setNZD(String NZD) {
              this.NZD = NZD;
          }
  
          public String getBRL() {
              return BRL;
          }
  
          public void setBRL(String BRL) {
              this.BRL = BRL;
          }
  
          List&lt;Model&gt; getCurrencyValuesList() {
  
              List&lt;Model&gt; currencyValues = new ArrayList&lt;&gt;();
              currencyValues.add(new Model("BGN", getAUD()));
              currencyValues.add(new Model("NZD", getNZD()));
              currencyValues.add(new Model("ILS", getILS()));
              currencyValues.add(new Model("RUB", getRUB()));
              currencyValues.add(new Model("CAD", getCAD()));
              currencyValues.add(new Model("USD", getUSD()));
              currencyValues.add(new Model("PHP", getPHP()));
              currencyValues.add(new Model("CHF", getCHF()));
              currencyValues.add(new Model("ZAR", getZAR()));
              currencyValues.add(new Model("AUD", getAUD()));
              currencyValues.add(new Model("JPY", getJPY()));
              currencyValues.add(new Model("TRY", getTRY()));
              currencyValues.add(new Model("HKD", getHKD()));
              currencyValues.add(new Model("MYR", getMYR()));
              currencyValues.add(new Model("THB", getTHB()));
              currencyValues.add(new Model("HRK", getHRK()));
              currencyValues.add(new Model("NOK", getNOK()));
              currencyValues.add(new Model("IDR", getIDR()));
              currencyValues.add(new Model("DKK", getDKK()));
              currencyValues.add(new Model("CZK", getCZK()));
              currencyValues.add(new Model("HUF", getHUF()));
              currencyValues.add(new Model("GBP", getBGN()));
              currencyValues.add(new Model("KRW", getKRW()));
              currencyValues.add(new Model("ISK", getISK()));
              currencyValues.add(new Model("SGD", getSGD()));
              currencyValues.add(new Model("BRL", getBRL()));
              currencyValues.add(new Model("PLN", getPLN()));
              currencyValues.add(new Model("INR", getINR()));
              currencyValues.add(new Model("RON", getRON()));
              currencyValues.add(new Model("CNY", getCNY()));
              currencyValues.add(new Model("SEK", getSEK()));
              return currencyValues;
          }
      }
  }
  </code></pre>
  
  <p>Api class:</p>
  
  <pre><code>public interface Api {
  
      @GET("latest")
      Call&lt;Model.Rates&gt; getRates();
  }
  </code></pre>