我得到一个json
像咆哮,服务:验证空花括号JSON - 安卓
[
{
"commentID": 21,
"commentAuthor": "AAA",
"commentText": "BBB",
"commentDate": 1484824835,
"productName": "XXXXX",
"productUrl": "xxx.html",
"productPictureUrl": "yyy.jpg"
} ,
{
"commentID": 21,
"commentAuthor": "AAA",
"commentText": "BBB",
"commentDate": 1484824835,
"productName": "XXXXX",
"productUrl": "xxx.html",
"productPictureUrl": "yyy.jpg"
}
]
我得到上面json
与retrofit
和Gson
。
Problem
:当json
是空的像波纹管我怎么可以验证它?
[{}]
我得到的json
值与Gson
像波纹管:
RetrofitApi.getVendorAdminApi()
.getComments(userToken, pageNumber)
.enqueue(new Callback<List<Comment>>() {
@Override
public void onResponse(Call<List<Comment>> call, Response<List<Comment>> response) {
if (response.isSuccessful()) {
resultListener.onSuccess(response.body());
} else {
resultListener.onFailure();
}
}
@Override
public void onFailure(Call<List<Comment>> call, Throwable t) {
resultListener.onFailure();
t.printStackTrace();
}
});
为什么你的Web服务要返回'[{}]'而不是'[]'
equals()
和hashcode()
方法呢? –