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
使用 JSONPath的 set 方法 对 JSONObject 进行修改, 当修改的 key 层级大于等于3层级, 且value 为null的情况下无法修改成功.
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONPath; import com.alibaba.fastjson2.JSONWriter; import org.junit.Test; public class FastJsonBugJava { @Test public void commitBug(){ JSONPath of = JSONPath.of("$.a.b.name"); JSONObject jsonObject = new JSONObject(); System.out.println("before jsonObject: " + jsonObject.toJSONString(JSONWriter.Feature.WriteNulls)); of.set(jsonObject,null); System.out.println("after jsonObject: " + jsonObject.toJSONString(JSONWriter.Feature.WriteNulls)); } } //输出结果为: // before jsonObject: {} // after jsonObject: {}
after jsonObject: {"a":{"b":{"name":null}}}
输出结果为: before jsonObject: {} after jsonObject: {}
同时发现, 在3层嵌套的层级下, 先set一个value不为null的key_value, 那么value为null的key_value可以修改成功.
The text was updated successfully, but these errors were encountered:
fix JSONPath set null not work, for issue #2656
9ed216f
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.52-SNAPSHOT/ 问题已修复,请用2.0.52-SNAPSHOT版本帮忙验证
Sorry, something went wrong.
使用 2.0.52-SNAPSHOT版本验证, 上述问题已经解决.
请问什么时候正式发布 2.0.52
预计在6月30日
https://github.com/alibaba/fastjson2/releases/tag/2.0.52 问题已修复,请用新版本
No branches or pull requests
问题描述
使用 JSONPath的 set 方法 对 JSONObject 进行修改, 当修改的 key 层级大于等于3层级, 且value 为null的情况下无法修改成功.
环境信息
重现步骤
期待的正确结果
after jsonObject: {"a":{"b":{"name":null}}}
相关日志输出
输出结果为:
before jsonObject: {}
after jsonObject: {}
附加信息
同时发现, 在3层嵌套的层级下, 先set一个value不为null的key_value, 那么value为null的key_value可以修改成功.
The text was updated successfully, but these errors were encountered: