我的Pojo课程 公共类用户{
private Long id;
private String name;
private Date dob;
@java.beans.ConstructorProperties({"id", "name", "dob"})
public User(Long id, String name, Date dob) {
this.id = id;
this.name = name;
this.dob = dob;
}
public User() {
}
public Long getId() {
return this.id;
}
public String getName() {
return this.name;
}
public Date getDob() {
return this.dob;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setDob(Date dob) {
this.dob = dob;
}
}
请求:
{"名称":"雷迪"" DOB":" 2018-02-16T04:16:29.698 + 0000"}
回复:如果不存在,我会递增ID { " id":8, " name":null, " dob":null }
答案 0 :(得分:0)
如果您使用Gson进行解组,请尝试以下操作。
Gson gson = new Gson() ;
data = gson.fromJson("Your Json", User.class)