当前位置:网站首页>Gson fastjason Jackson of object to JSON difference modifies the field name

Gson fastjason Jackson of object to JSON difference modifies the field name

2022-04-23 18:10:00 dawnsun001

 Entity Bean:
package .....;

import java.io.Serializable;

public class BeanVO implements Serializable {
    
    private String id;
    private String GPSDetail;

    public BeanVO() {
    }
    ..........get&set.........................
  
}
 Perform test methods :
 public static void main(String[] args) {
        BeanVO ff = new BeanVO();
        ff.setGPSDetail("1");
        System.out.println("--fastjson-"+JSONObject.toJSONString(ff));
        System.out.println("--jackson-"+JsonSupport.object2Json(ff));
        System.out.println("--gson-"+new Gson().toJson(ff));
    }
 result :
--fastjson-{"gPSDetail":"1"}
--jackson-{"gpsDetail":"1"}
--gson-{"GPSDetail":"1"}


版权声明
本文为[dawnsun001]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230544289193.html