We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
保持POJO中定义的字段顺序不生效
import java.math.BigDecimal; import java.util.Date; import com.alibaba.fastjson2.annotation.JSONType; import lombok.Data; @Data @JSONType(alphabetic = false) public class TobeDelivery { private String ProjectNO; private String OrderNO; private String OrderType; private String PN; private Integer Qty; private String Description; private String CustomerCode; private String CustomerName; private String Currency; private BigDecimal NetPrice; private BigDecimal USD; private Float Rate; private Date OrderDate; private Date RequestDate; private Date PlanedDate; }
JSON.config(JSONWriter.Feature.FieldBased);
输出的json字段和pojo定义的一样。
这个描述,容易理解为设置了,就能按定义字段的顺序进行输出。
设置@jsontype(alphabetic = false) 或者JSON.config(JSONWriter.Feature.FieldBased), 两者任意一个都能保持字段定义的顺序。
The text was updated successfully, but these errors were encountered:
fix consistent with declared orders when alphabetic is false, for issue
ef545f5
#2959
Fix 2959 (#2960)
4686c2c
* fix consistent with declared orders when alphabetic is false, for issue #2959 * fix checkstyle
https://github.com/alibaba/fastjson2/releases/tag/2.0.53 问题已修复,请用新版本
Sorry, something went wrong.
yanxutao89
No branches or pull requests
问题描述
保持POJO中定义的字段顺序不生效
重现步骤
期待的正确结果
输出的json字段和pojo定义的一样。
这个描述,容易理解为设置了,就能按定义字段的顺序进行输出。
建议
设置@jsontype(alphabetic = false) 或者JSON.config(JSONWriter.Feature.FieldBased), 两者任意一个都能保持字段定义的顺序。
The text was updated successfully, but these errors were encountered: