We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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.toJSONString解析StringBuilder和StringBuffer对象时,返回值均为 {}。
请填写以下信息:
public static void main(String[] args) { StringBuilder sBuilder = new StringBuilder(" 123 "); StringBuffer sBuffer = new StringBuffer(" 123"); Gson gson = new Gson(); log.info("原String:{},{},gson: {},{}, fastjson :{},{}", sBuilder.toString(),sBuffer.toString(), gson.toJson(sBuilder),gson.toJson(sBuffer), JSON.toJSONString(sBuilder),JSON.toJSONString(sBuffer)); }
类似gson返回原对象的字符串。
2022-08-13 15:12:36 707 [INFO] [c=StringUtilsTest] [41] [main] [mainraceId] 原String: 123 , 123,gson: " 123 "," 123", fastjson :{},{}
The text was updated successfully, but these errors were encountered:
serialize/deserialize support StringBuilder & Stringbuffer, fix issue #…
7ba26eb
…687
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.12-SNAPSHOT/ 问题已修复,请帮忙用2.0.12-SNAPSHOT版本验证,2.0.12版本预计在8月21日前发布
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.12 问题已修复,请用新版本
No branches or pull requests
问题描述
JSON.toJSONString解析StringBuilder和StringBuffer对象时,返回值均为 {}。
环境信息
请填写以下信息:
重现步骤
期待的正确结果
类似gson返回原对象的字符串。
相关日志输出
2022-08-13 15:12:36 707 [INFO] [c=StringUtilsTest] [41] [main] [mainraceId] 原String: 123 , 123,gson: " 123 "," 123", fastjson :{},{}
The text was updated successfully, but these errors were encountered: