一篇文章弄懂JSON和FastJSON

时间:2025-04-01 11:50:22
package com.bayar.employee; import java.util.Date; import com.alibaba.fastjson.annotation.JSONField; public class Employee { private Integer empno; private String ename; private String job; @JSONField(name="入职时间", format="yyyy-MM-dd") private Date hiredata; private Float salary; //某一项无关紧要,不想序列化时用@JSONField(serialize=false) @JSONField(serialize=false) private String dname; public Integer getEmpno() { return empno; } public String getEname() { return ename; } public String getJob() { return job; } public Date getHiredata() { return hiredata; } public Float getSalary() { return salary; } public String getDname() { return dname; } public void setEmpno(Integer empno) { this.empno = empno; } public void setEname(String ename) { this.ename = ename; } public void setJob(String job) { this.job = job; } public void setHiredata(Date hiredata) { this.hiredata = hiredata; } public void setSalary(Float salary) { this.salary = salary; } public void setDname(String dname) { this.dname = dname; } }