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

[struct_json]考虑为string解析为json时添加转义 #577

Closed
Chessom opened this issue Jan 25, 2024 · 5 comments
Closed

[struct_json]考虑为string解析为json时添加转义 #577

Chessom opened this issue Jan 25, 2024 · 5 comments

Comments

@Chessom
Copy link

Chessom commented Jan 25, 2024

目前的struct_json对string的内容没有检查,在字符串中含有单双引号等json语法字符时不会添加转义,导致解析to_json()产出的json时会解析失败。所以可否考虑为string对象添加对特殊字符的转义,或者添加一个重载?

@qicosmos
Copy link
Collaborator

谢谢报告,晚点回给出一个处理方法。

@Chessom
Copy link
Author

Chessom commented Jan 26, 2024

谢谢你的工作,这个库很优雅实用!

@qicosmos
Copy link
Collaborator

@Chessom
你可以验证一下这个pr吗?看看转义是不是解决了。默认是开启转义的,用户可以设置参数不启用转义。

#581

@Chessom
Copy link
Author

Chessom commented Jan 29, 2024

@qicosmos 验证了几个样例,确实解决了,感谢付出。

@qicosmos
Copy link
Collaborator

感谢 @bbbgan 贡献的pr。

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