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 optstr reader #339

Merged
merged 4 commits into from
Dec 9, 2024
Merged

Json optstr reader #339

merged 4 commits into from
Dec 9, 2024

Conversation

CBookShu
Copy link
Contributor

@CBookShu CBookShu commented Dec 9, 2024

close #337

解决方案:
optional 的时候不判断 "null",而是判断 null 。 当类型是string,则单独针对它判断 " 开头,其他情况不允许 " 开头了。

测试:
windows 2019 + c++17 (原有的json测试用例在2019上实际会编译卡死,这个应该不是库的问题,测试时删除了异常的用例)
ubuntu 2204 gcc11.4.0

风险:
如果原来的应用依赖于,通过字符串再解析出 obj来,会异常;现在如果字段是非string,则value不能再 " 开头了。

@qicosmos qicosmos self-requested a review December 9, 2024 03:56
Copy link
Owner

@qicosmos qicosmos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qicosmos qicosmos merged commit 4ea64b7 into qicosmos:master Dec 9, 2024
14 of 18 checks passed
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.

optional<std::string> from_json 异常
2 participants