如何从json响应中获取列表?我已经从json对象中获取了一些数据,但是没有从List中获取一些数据,不确定如何做到这一点
Api
@GET("weather")
Call<List<Model>> getNewestForecast(
@Query("lat") Double latitude,
@Query("lon") Double longitude,
@Query("appid") String key);
POJO
@SerializedName("weather")
private List<Weather> weather;
public List<Weather> getWeather() {
return weather;
}
class Weather{
@SerializedName("icon")
private String forecastIcon;
public String getForecastIcon() {
return forecastIcon;
}
}
JSON响应
"weather": [
{
"id": 520,
"main": "Rain",
"description": "light intensity shower rain",
"icon": "09n"
}
]
reotrofit onResponse方法的外观应该如何?