因为回答是这样的
{
"statusCode": 200,
"headers": {
"Content-Type": "application/json"
},
"body": { "companyname": "hitouch", "email": "a@b.com", "gst_no": "12354" }
}
你必须像这样使用pojo
public class CompanyInfoResponse {
@SerializedName("statusCode")
int statusCode;
@SerializedName("headers")
Map headers;
@SerializedName("body")
CompanyInfo companyInfo;
}
把它改成
@GET("getbusinessprofile/{username}")
Call>
getCompanydetails(@Path("username")String username);
获取实际数据
CompanyInfo companyInfo = response.body().getBody();
如果您想将它应用于不同类型的响应(如employeeinfo),可以使用这样的包装器
public class ApiR