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
在 fastjson2 中,JSONPath.extract 与 eval 表现不一致 在 fastjson 1.2.83 中是正常的。
public static void main(String[] args) { String json = "{\"status\":0}"; String path = "$.status"; Object rt1 = JSONPath.extract(json, path); System.out.println(rt1);// 0 Object rt2 = JSONPath.eval(json, path); System.out.println(rt2);// null }
需要表现一致
The text was updated successfully, but these errors were encountered:
JSONPath.eval support String input, fix issue #553
238b707
这,,是因为入参是String 的问题嘛,试了当 入参数是 String, path 是多级(非json的1级)时,是正常的。
以下例子,eval 的第一个参数仍然是字符串,但在 fastjson 1.2.83, fastjson2.0.9 都是正常的。只有 path 取一级的时候才会是空
public static void main(String[] args) { String json = "{\"status\":0,\"data\":{\"code\":0}}"; String path = "$.data.code"; Object rt1 = JSONPath.extract(json, path); System.out.println(rt1);// 0 Object rt2 = JSONPath.eval(json, path); System.out.println(rt2);// null }
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.10 问题已修复,请用新版本
No branches or pull requests
问题描述
在 fastjson2 中,JSONPath.extract 与 eval 表现不一致
在 fastjson 1.2.83 中是正常的。
环境信息
重现步骤
期待的正确结果
需要表现一致
The text was updated successfully, but these errors were encountered: