我得到一個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()
方法呢? –