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
希望将空字符或者空流转成JSONObject不用报错,而是返回空对象。(2.0.5版本)
一些空值,或者空参数建议不要直接报错,而是返回一个空对象,因为从fastjson迁移到fastjson2时发现一些空参数不能转成JSONObject。
部分情况下使用parseObject(String text)可以解决空串的问题
1.空串转成JSONObject报错(fastjson1.x版本没有问题)。 String whiteConfig = ""; com.alibaba.fastjson2.JSONObject whiteListJson = com.alibaba.fastjson2.JSON.parseObject(whiteConfig, com.alibaba.fastjson2.JSONObject.class); 可以使用parseObject(String text)这个方法,但是最好做一下兼容。
2.使用后的流转换JSONObject报错(fastjson1.x版本没有问题)。 ClassPathResource jsoupWhiteListPathRes = new ClassPathResource("/json/xxx.json"); InputStream whiteConfig = jsoupWhiteListPathRes.getInputStream(); com.alibaba.fastjson2.JSONObject whiteListJson2 = com.alibaba.fastjson2.JSON.parseObject(whiteConfig); com.alibaba.fastjson2.JSONObject whiteListJson3 = com.alibaba.fastjson2.JSON.parseObject(whiteConfig);
The text was updated successfully, but these errors were encountered:
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.6-SNAPSHOT/
问题已经修复,请帮忙用2.0.6-SNAPSHOT版本验证,2.0.6正式版预计6月5日前发布
Sorry, something went wrong.
好的感谢。
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.6-SNAPSHOT/ 问题已经修复,请帮忙用2.0.6-SNAPSHOT版本验证,2.0.6正式版预计6月5日前发布
https://github.com/alibaba/fastjson2/releases/tag/2.0.6 问题已经修复,请用新版本
No branches or pull requests
请描述您的需求或者改进建议
希望将空字符或者空流转成JSONObject不用报错,而是返回空对象。(2.0.5版本)
请描述你建议的实现方案
一些空值,或者空参数建议不要直接报错,而是返回一个空对象,因为从fastjson迁移到fastjson2时发现一些空参数不能转成JSONObject。
描述您考虑过的替代方案
部分情况下使用parseObject(String text)可以解决空串的问题
附加信息
1.空串转成JSONObject报错(fastjson1.x版本没有问题)。
String whiteConfig = "";
com.alibaba.fastjson2.JSONObject whiteListJson = com.alibaba.fastjson2.JSON.parseObject(whiteConfig, com.alibaba.fastjson2.JSONObject.class);
可以使用parseObject(String text)这个方法,但是最好做一下兼容。
2.使用后的流转换JSONObject报错(fastjson1.x版本没有问题)。
ClassPathResource jsoupWhiteListPathRes = new ClassPathResource("/json/xxx.json");
InputStream whiteConfig = jsoupWhiteListPathRes.getInputStream();
com.alibaba.fastjson2.JSONObject whiteListJson2 = com.alibaba.fastjson2.JSON.parseObject(whiteConfig);
com.alibaba.fastjson2.JSONObject whiteListJson3 = com.alibaba.fastjson2.JSON.parseObject(whiteConfig);
The text was updated successfully, but these errors were encountered: