如果請求響應是這樣
{"sentences":
[
{
"trans":"It works.","orig":"Это работает.",
"translit":"","src_translit":"Eto rabotayet.",
"src":"ru",
"server_time":12
}
]
}
那麼,你的班會
public class Sentence {
@Expose
private String trans;
@Expose
private String orig;
@Expose
private String translit;
@SerializedName("src_translit")
@Expose
private String srcTranslit;
@Expose
private String src;
@SerializedName("server_time")
@Expose
private Integer serverTime;
public String getTrans() {
return trans;
}
public void setTrans(String trans) {
this.trans = trans;
}
public String getOrig() {
return orig;
}
public void setOrig(String orig) {
this.orig = orig;
}
public String getTranslit() {
return translit;
}
public void setTranslit(String translit) {
this.translit = translit;
}
public String getSrcTranslit() {
return srcTranslit;
}
public void setSrcTranslit(String srcTranslit) {
this.srcTranslit = srcTranslit;
}
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public Integer getServerTime() {
return serverTime;
}
public void setServerTime(Integer serverTime) {
this.serverTime = serverTime;
}
}
主應答類
public class TranslateResp {
@Expose
private List<Sentence> sentences = new ArrayList<Sentence>();
public List<Sentence> getSentences() {
return sentences;
}
public void setSentences(List<Sentence> sentences) {
this.sentences = sentences;
}
}
做訪問Json Schema 2 Pojo
您的請求響應不是有效的json格式。請先檢查一下。 – Bharatesh 2015-03-19 12:02:30
檢查 - 現在沒事 – SERG 2015-03-19 14:18:20