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

Json serilize for object httpapi #1614

Closed

Conversation

superheizai
Copy link
Contributor

#1613

specify the option for disable circular reference when serialize the object with fastjson.

@hengyunabc
Copy link
Collaborator

格式化是空格,不要用tab。

@hengyunabc
Copy link
Collaborator

还是有不少不必要的格式化,最好是只提交必要的修改的地方。

update tab to space
@hengyunabc
Copy link
Collaborator

感觉应该设置为全局属性,应该找个地方直接设置:

JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.DisableCircularReferenceDetect.getMask();

可以直接放在 https://github.com/alibaba/arthas/blob/arthas-all-3.4.5/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java#L122

@superheizai
Copy link
Contributor Author

OK。
明天测试下,再提交。

@superheizai
Copy link
Contributor Author

准备在ArthasBootStrap里面的增加一个方法,放在bind(config)之后,用来初始化像这种第三方的基础配置,如何?

private void initProperties() {
// disable fastjson circular reference option
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.DisableCircularReferenceDetect.getMask();
}

@hengyunabc
Copy link
Collaborator

@superheizai initProperties 这个命名不太合适, initFastJSON更合理一点。

另外,HttpApiHandler.java 应该恢复原来的代码,不需要做修改了。

@hengyunabc hengyunabc added this to the 3.4.6 milestone Dec 11, 2020
@hengyunabc hengyunabc closed this Dec 11, 2020
@hengyunabc
Copy link
Collaborator

用指定author的方式合并了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants