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

有没有推荐的HandyJSON的替代方案? #493

Open
KDGoldenGuy opened this issue Apr 25, 2024 · 4 comments
Open

有没有推荐的HandyJSON的替代方案? #493

KDGoldenGuy opened this issue Apr 25, 2024 · 4 comments

Comments

@KDGoldenGuy
Copy link

看到HandyJSON群里说不再维护,担心继续出现版本升级的crash。官方的Codable使用起来不方便,而且遇到字段缺失就不工作。 请问有推荐的低成本低替换方案么?
企业微信截图_4c94f43b-56e5-46c2-94bb-fd6b059cb34c

@intsig171
Copy link

几乎无障碍替换HandyJSON的方案SmartCodable: https://github.com/intsig171/SmartCodable
提供了详尽的替换说明。欢迎体验。
我的项中有1400+处使用HandyJSON,3天就全部替换完了。

image

image

@KDGoldenGuy
Copy link
Author

下载下来看了下,测试用例很丰富,场景覆盖很全,使用和HandyJSON差别不大,感谢大佬,感恩🙏

IMG_0269
IMG_0271
IMG_0270

@applebest
Copy link

几乎无障碍替换HandyJSON的方案SmartCodable: https://github.com/intsig171/SmartCodable 提供了详尽的替换说明。欢迎体验。 我的项中有1400+处使用HandyJSON,3天就全部替换完了。

image

image

感谢 ,因为项目统一封装了解析处理的过程调用,使用SmartCodable替换几乎无成本,项目只需要下一个版本,回归测试一下即可🤝 另外想请教一下,Codable模型定义struct还是class ,因使用HandyJSON时,定义了class BaseModel : HandyJSON {} , 其他model继承BaseModel即可,这种方案在SmartCodable可行吗?

@intsig171
Copy link

问题1:
Codable模型定义struct 和 class 均可以。

问题2:
定义了class BaseModel : HandyJSON {} , 其他model继承BaseModel即可。Codable的解析对继承的解析需要自己实现解析逻辑(可以看demo中的演示)。直白的说:继承的支持不友好,使用起来不方便。你可以加一下QQ群: 865036731。我看看你的代码情况。

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

3 participants