Reputation: 209
How to retrieve this ? I tried creating 2 model class one for the "sys" and the other one is for the child of "sys" but it did not work:
class Sys:
public class Sys {
private ArrayList<SysInfo> sys = new ArrayList<>();
public ArrayList<SysInfo> getSys() {
return sys;
}
public void setSys(ArrayList<SysInfo> sys) {
this.sys = sys;
}
class SysInfo
public class SysInfo {
private String country;
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
Upvotes: 1
Views: 394
Reputation: 49
To get sys object user
import com.google.gson.annotations.SerializedName;
public class SysParent {
@SerializedName("sys")
private Sys sysObj;
public Sys getSysObj() {
return sysObj;
}
public void setSysObj(Sys sysObj) {
this.sysObj = sysObj;
}
}
and to get values in sys use following class.
import com.google.gson.annotations.SerializedName;
public class Sys {
@SerializedName("country") private String country;
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
}
Upvotes: 1