网址:http://www.bejson.com/json2javapojo/
选择JSON相关—>JSON生成Java实体类,在编辑框内输入JSON内容
{
“status”:1,
“content”:{
“from”:”zh-CN”,
“to”:”en-US”,
“out”:”Monday”,
“vendor”:”ciba”,
“err_no”:0
}
}
修改类名,包名,点击生成JavaBean
package com.besjon.pojo;
public class JsonTest {
private int status;
private Content content;
public void setStatus(int status) {
this.status = status;
}
public int getStatus() {
return status;
}
public void setContent(Content content) {
this.content = content;
}
public Content getContent() {
return content;
}
}
public class Content {
private String from;
private String to;
private String out;
private String vendor;
private int err_no;
public void setFrom(String from) {
this.from = from;
}
public String getFrom() {
return from;
}
public void setTo(String to) {
this.to = to;
}
public String getTo() {
return to;
}
public void setOut(String out) {
this.out = out;
}
public String getOut() {
return out;
}
public void setVendor(String vendor) {
this.vendor = vendor;
}
public String getVendor() {
return vendor;
}
public void setErr_no(int err_no) {
this.err_no = err_no;
}
public int getErr_no() {
return err_no;
}
}