public class LoginModel {
@SerializedName("body")
private Body body;
public Body getBody() {
return body;
}
public static class Body {
@SerializedName("userPwd")
private String userpwd;
@SerializedName("prodId")
private int prodid;
@SerializedName("emailId")
private String emailid;
@SerializedName("customerId")
private int customerid;
public String getUserpwd() {
return userpwd;
}
public int getProdid() {
return prodid;
}
public String getEmailid() {
return emailid;
}
public int getCustomerid() {
return customerid;
}
}
}
Now in if you followed this answer you retrofit interface is something like this
@Headers("Content-Type: application/json")
@POST("login/desktop/user")
Call<ResponseBody> getToken(@Body HashMap<String, HashMap<String, Object>> data);
change it to
@Headers("Content-Type: application/json")
@POST("login/desktop/user")
Call<LoginModel> getToken(@Body HashMap<String, HashMap<String, Object>> data); // change here
Now you can get your data in onResponse() like this
LoginModel loginData = response.body();
String pswd = loginData.getBody().getUserpwd();
PS = if you can change the response I suggest you to change var body from response to something else like data.
SerializedName used in POJO class are not important, read more about them here
Hope this will help!