當我休息班時,我收到了下面的回覆。Json的響應值沒有設置到Bean類
響應:
{
"_index": "a_index",
"total":9,
"_type": "e",
"_id": "BSKnamtd_8-egMNvh",
"_data": 2.076404564,
"_secure": {
"email": "[email protected]"
}
}
要設置該響應。如圖所示,我創建了pojo類。
public class data implements Serializable {
private static final long serialVersionUID = 644188100766481108L;
private String _index;
private Integer total;
private String _type;
private String _id;
private Double _data;
private Source _secure;
public String getIndex() {
return _index;
}
public void setIndex(String _index) {
this._index = _index;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public String getType() {
return _type;
}
public void setType(String _type) {
this._type = _type;
}
public String getId() {
return _id;
}
public void setId(String _id) {
this._id = _id;
}
public Double getData() {
return _data;
}
public void setData(Double _data) {
this._data = _data;
}
public Source getSecure() {
return _secure;
}
public void setSecure(Source _secure) {
this._secure = _secure;
}
}
當我打了電話RESTClient實現,我只得到「全部」剩餘價值得到儘可能空值。 「total」變量沒有下劃線(「」)其餘變量有「」,這樣我就面臨着問題..?
請幫助如何解決這個問題。
運氣好的話這個這麼遠? –