title: How to retrieve objects with different names from the same url using Retrofit
body: <p>I'm using Retrofit in order to retrieve the data from an API. This is the url <a href="http://mindicador.cl/api" rel="nofollow noreferrer">http://mindicador.cl/api</a> and I need to retrieve the objects with the name of "uf", "dolar", "euro" and "utm", all those four in one call. This is my Java class based on the json. </p>
  
  <pre><code>public class IEconomicoAPI {
      private String version;
      private String autor;
      private String fecha;
      @SerializedName(value = "uf", alternate = {"dolar", "euro", "utm"})
      private IEconomicoObject uf;
  
      /* All Getter and Setter methods */
  }
  </code></pre>
  
  <p>And this is my call method to retrieve the data which is not working right now.</p>
  
  <pre><code>void call() {
          Retrofit retrofit = new Retrofit.Builder()
                  .baseUrl(MiIndicadorAPI.BASE_URL)
                  .addConverterFactory(GsonConverterFactory.create())
                  .build();
  
          MiIndicadorAPI api = retrofit.create(MiIndicadorAPI.class);
  
          final Call&lt;IEconomicoAPI&gt; iEconomicoAPICall = api.getAPI();
          iEconomicoAPICall.enqueue(new Callback&lt;IEconomicoAPI&gt;() {
              @Override
              public void onResponse(Call&lt;IEconomicoAPI&gt; call, Response&lt;IEconomicoAPI&gt; response) {
                  String codigo = response.body().getUf().getCodigo();
                  if (codigo.equals("uf")) {
                      Log.e("info", "nombre: " + response.body().getUf().getNombre());
                  }
              }
  
              @Override
              public void onFailure(Call&lt;IEconomicoAPI&gt; call, Throwable t) {
  
              }
          });
      }
  </code></pre>
  
  <p>I was thinking in a solution which is create 4 objects (one for uf, dolar, euro and utm) but I think is redundant because all these objects have the same fields and the more convenient way should be create just one object. Anyway I hope you orient me about how to resolve this issue. Thanks for advance.</p>