I'm trying to convert a JSON to GSON I'm not sure this is the best structure.
All responses consist of code, msg, and data structure. But the internal structure of data can vary.
Do I have to create a response object even if there is only one value in the data like this?
If you know a better way than this, please advise me. thank you :)
{
"code": "000",
"msg": "okay",
"data": {
"myCartCount": "0"
}
}
this is my reponse object
public class BaseResponse{
public String code;
public String msg;
}
public class MyCartResponse extends BaseResponse{
@SerializedName("data")
public MyCart myCart;
}
public class MyCart{
@SerializedName("myCartCount")
public String count;
}