-
Notifications
You must be signed in to change notification settings - Fork 496
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
[BUG] JSONPath 自动过滤 null 属性 #1159
Comments
在mysql8中:
返回结果是这个:
|
在 fastjson1 中具有参数 ignoreNullValue,可以保留 null 值,是否可以保留这一参数? public static Object eval(Object rootObject, String path, boolean ignoreNullValue) {
JSONPath jsonpath = compile(path, ignoreNullValue);
return jsonpath.eval(rootObject);
} |
JSONObject jsonObject = JSON.parseObject(s);
String key = "data[*].title";
JSONPath jsonPath = JSONPath.of(key, Collection.class, JSONPath.Feature.KeepNullValue);
Collection eval = (Collection) jsonPath.eval(jsonObject);
assertEquals("[\"title_1\",null,\"title_3\"]", eval.toString()); https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.26-SNAPSHOT/ |
wenshao
added a commit
that referenced
this issue
Mar 16, 2023
验证通过,感谢 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
简要描述您碰到的问题。
JSONPath 自动删除 null 属性
环境信息
请填写以下信息:
重现步骤
如何操作可以重现该问题:
期待的正确结果
对您期望发生的结果进行清晰简洁的描述。
[
"title_1",
null,
"title_3"
]
相关日志输出
请复制并粘贴任何相关的日志输出。
输出结果:["title_1","title_3"]
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
The text was updated successfully, but these errors were encountered: