java - Retrofit 2.0 parsing complex api -
i using retrofit consume weather api, before had deal own backend tweak parse data nicely. time getting json looks :
{ "city": { "id": 838920, "name": "ledine", "coord": { "lon": 20.34833, "lat": 44.802502 }, "country": "rs", "population": 0, "sys": { "population": 0 } }, "cod": "200", "message": 0.2644, "cnt": 35, "list": [ { "dt": 1478271600, "main": { "temp": 281.58, "temp_min": 280.9, "temp_max": 281.58, "pressure": 1024.56, "sea_level": 1035.66, "grnd_level": 1024.56, "humidity": 90, "temp_kf": 0.68 }, "weather": [ { "id": 800, "main": "clear", "description": "clear sky", "icon": "01d" } ], "clouds": { "all": 0 }, "wind": { "speed": 3.04, "deg": 106.5 }, "rain": {}, "sys": { "pod": "d" }, "dt_txt": "2016-11-04 15:00:00" }, { ...... ...... } ] }
the model have made seems complex, struggling last week or so. appreciated. thanks!
this simple :
model have :
public class weather implements serializable { public cityobj city; public class cityobj { public string name; public int id; public coordobj coord; public string country; public string population; public sysobj sys; } public class coordobj { public long lon; public long lat; } public class sysobj { public int population; } . . . }
Comments
Post a Comment