Skip to content
New issue

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

[FEATURE] 能不能输出属性不要按字母排序 按javabean代码属性顺序 #713

Closed
javahui opened this issue Aug 27, 2022 · 3 comments
Labels
enhancement New feature or request fixed
Milestone

Comments

@javahui
Copy link

javahui commented Aug 27, 2022

能不能输出属性不要按字母排序按 javabean属性顺序

public class SystemUser {
	private Integer id;
	private String code;
	private String password;
}

输出{ "id": 1 , code: "10001", password:"123456" } 效果这样

@javahui javahui added the enhancement New feature or request label Aug 27, 2022
@javahui javahui changed the title [FEATURE] [FEATURE] 能不能输出属性不要按字母排序 按javabean代码属性顺序 Aug 27, 2022
@wenshao wenshao added this to the 2.0.13 milestone Aug 27, 2022
@wenshao
Copy link
Member

wenshao commented Aug 28, 2022

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.13-SNAPSHOT/
请用2.0.13-SNAPSHOT版本验证,2.0.13版本预计在9月12日前发布。需要配置JSONType.alphabetic = true,比如

@JSONType(alphabetic=false)
public class SystemUser {
	private Integer id;
	private String code;
	private String password;
}

这个取决于编译器的行为,顺序不确定的

@wenshao wenshao added the fixed label Aug 28, 2022
@javahui
Copy link
Author

javahui commented Sep 6, 2022

https://os.sonatype.org/jsoncontent/repositories/snapshots/com/alib/fastjson2/fastaba/2.0.13-SNAPSHOT/ 用2.0.13-SNAPSHOT版本,验证2.0.13版本请在9月12日前发布发布。需要配置JSONType.alphabetic = true,比如

@JSONType(alphabetic=false)
public class SystemUser {
	private Integer id;
	private String code;
	private String password;
}

什么是这个编译器的行为,目的是

我是过滤中得到Bean,有可能是各种形式的bean, 我不可在所有bean上加@jsontype, 能不能加个SerializerFeature参数

@wenshao
Copy link
Member

wenshao commented Sep 10, 2022

https://github.com/alibaba/fastjson2/releases/tag/2.0.13
2.0.13版本已经发布,请用帮忙用新版本验证

@wenshao wenshao closed this as completed Sep 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed
Projects
None yet
Development

No branches or pull requests

2 participants