-
Notifications
You must be signed in to change notification settings - Fork 495
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
JSONPath 多层结构的set #424
Comments
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.7-SNAPSHOT/ |
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.7-SNAPSHOT/ bug已修复,请帮用2.0.7-SNAPSHOT版本验证 已用2.0.7-SNAPSHOT版本验证过未解决问题 不过 JSONPath.set(jsonObject, "a[0].b", 1); 这种写法可以 |
2.0.7 正式版貌似 JSONPath.set(jsonObject, "a/0/b", 1); 结果还是{"a":1} 而不是{"a":[{"b":1}]},还是不对啊 |
这个不是支持的语法,不支持的,应该报错的 |
因为是调用 System.out.println(JSONPath.paths(JSON.parseObject("{"a":[{"b":1}]}"))); 输出了{/a=[{"b":1}], /a/0={"b":1}, /a/0/b=1, /={"a":[{"b":1}]}} 所以使用了这种语法,并且fastjson1 也是支持的 |
JSONObject jsonObject = new JSONObject();
JSONPath.set(jsonObject, "a/0/b", 1);
System.out.println(jsonObject);
期待 {"a":[{"b":1}]},依然不符合预期
Originally posted by @Wenkang-Du in #379 (comment)
The text was updated successfully, but these errors were encountered: