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

多态序列化格式的疑问 #13

Closed
SunHowe opened this issue Aug 25, 2022 · 2 comments
Closed

多态序列化格式的疑问 #13

SunHowe opened this issue Aug 25, 2022 · 2 comments

Comments

@SunHowe
Copy link

SunHowe commented Aug 25, 2022

image
看到多态序列化的ToJson步骤,除了1.0版本的RealTypeKey外,额外加入了一层objectKey,实际的对象序列化文本在objectKey对应的value中。
虽然可以理解是为了做多态序列化、反序列化的流程方便,但是这样会导致对象序列化后的json文本没办法在非CatJson环境下被正确反序列化解析(例如客户端ToJson后发送给服务端)

@CatImmortal
Copy link
Owner

此处修改主要是为了能够对其序列化格式非大括号形式的对象进行多态处理,如数字类型,字符串类型,数组类型等

而且多态处理格式并非标准Json规范的内容,因此设计时不考虑跨Json库的兼容性

@SunHowe
Copy link
Author

SunHowe commented Aug 25, 2022

好的,感谢猫大回复,我加个开关先临时处理一下~

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

No branches or pull requests

2 participants