Fastjson中通过@JSONType,@JSONField注解可以定义属性的顺序 如: @JSONType(orders={"name","age","gender","height","weight"}) public class Person { private String name; private Integer age; private String gender; private Double height; private Double weight; }
或者: public class Person { @JSONField(ordinal = 1) private String name; @JSONField(ordinal = 2) private Integer age; @JSONField(ordinal = 3) private String gender; @JSONField(ordinal = 4) private Double height; @JSONField(ordinal = 5) private Double weight; }
如果每个VO都显示的指定顺序会比较繁琐。所以,我的问题是: 1、fastjson设计为按顺序输出的目的是什么?
2、有没有全局的配置,来取消属性排序的功能?
3、是否会推出指定的SerializerFeature? 现有的SerializerFeature.SortField,SerializerFeature.MapSortField都是针对JSONField的。