i have a problem fetching data using retrofit, i usually using jsonschema2pojo for create object. first i have no problem at all. but after tracing what cause data null is the response.body()
not fetching full data, but some of them are called. after searching through the internet, i have answer that the object class is not matching with the response but i dont know what is mean matching at all.
this is my object class
public class KunjunganOutlet {
@SerializedName("status")
@Expose
private Boolean status;
@SerializedName("message")
@Expose
private String message;
@SerializedName("info")
@Expose
private Object info;
@SerializedName("data")
@Expose
private List<Data> data = null;
// and some getter setter
And Data
class
public class Data {
@SerializedName("id")
@Expose
private String id;
@SerializedName("nama")
@Expose
private String nama;
@SerializedName("jenis")
@Expose
private String jenis;
@SerializedName("alamat")
@Expose
private String alamat;
@SerializedName("tlp")
@Expose
private String tlp;
// and some getter setter
and here's my data from API
{
"status": true,
"message": "Successfully",
"info": null,
"data": [
{
"id": "47760",
"nama": "BKKBN Provinsi Aceh",
"jenis": "KLDI",
"alamat": "jl.t.nyak arief no 101 banda aceh\r\n",
"tlp": ""
},
{
"id": "47784",
"nama": "Dinkes Aceh Selatan",
"jenis": "Dinas Kesehatan",
"alamat": "Jl. Teungku Raja Angkasah Tapaktuan Telp. 0656-21829\r\n",
"tlp": ""
}
]
}
and the result only id that get from data
onResponse: {"data":[{"id":"5287"},{"id":"5185"}],"message":"Successfully","status":true}
UPDATE just wrong call after several attempt