If I try to get data from my Retrofit call, its empty. Probably because I use the wrong datatype.Not sure if its an Array or an ArrayList Maybe some one could help me out.
Api : https://chasing-coins.com/api/v1/top-coins/100
Interface :
@GET("api/v1/top-coins/{top}")
Call<JSONArray> getStats(@Path("top")String top);
Class :
public class Coinstats {
@SerializedName("symbol")
@Expose
private String symbol;
@SerializedName("cap")
@Expose
private String cap;
@SerializedName("change")
@Expose
private Change change;
@SerializedName("price")
@Expose
private String price;
@SerializedName("coinheat")
@Expose
private Integer coinheat;
@SerializedName("url")
@Expose
private String url;
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public String getCap() {
return cap;
}
public void setCap(String cap) {
this.cap = cap;
}
public Change getChange() {
return change;
}
public void setChange(Change change) {
this.change = change;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public Integer getCoinheat() {
return coinheat;
}
public void setCoinheat(Integer coinheat) {
this.coinheat = coinheat;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
Call:
call2.enqueue(new Callback<JSONArray>() {
@Override
public void onResponse(Call<JSONArray> call, Response<JSONArray> response) {
Log.w("Stats", response.message());
}
@Override
public void onFailure(Call<JSONArray> call, Throwable t) {
Log.w("no Stats", t.toString());
}
});
Respones Message gives me a good 200 but response.body is empty. Thank you!