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
{"code":0,"errMsg":"","Data":{"is_focus":1,"user_info":{"userid":"13814","nickname":"没事改昵称"}}}
JSONPath 能做到判断 Data.user_info.userid 这个 key 如果存在的话返回 Data 的 value 吗 ? 应该怎么写呢,感谢各位
The text was updated successfully, but these errors were encountered:
现在不支持,将会2.0.46版本(春节前发布)支持
Sorry, something went wrong.
public void test() { String str = "{\"code\":0,\"errMsg\":\"\",\"Data\":{\"is_focus\":1,\"user_info\":{\"userid\":\"13814\",\"nickname\":\"没事改昵称\"}}}"; JSONObject jsonObject = JSON.parseObject(str); assertSame(jsonObject, JSONPath.eval(jsonObject, "[?exists(@.Data.user_info.userid)]")); assertNull(JSONPath.eval(jsonObject, "[?exists(@.Data.user_info.userid1)]")); assertNull(JSONPath.eval(jsonObject, "[?exists(@.Data.user_info1.userid)]")); assertNull(JSONPath.eval(jsonObject, "[?exists(@.Data1.user_info.userid)]")); }
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.46-SNAPSHOT/ 已经支持,请帮忙用2.0.46-SNAPSHOT版本验证,正式版本预计在3月初发布。
可以正常匹配并且返回 Data 的 value 了,感谢 @wenshao
https://github.com/alibaba/fastjson2/releases/tag/2.0.46 问题已修复,请用新版本
No branches or pull requests
{"code":0,"errMsg":"","Data":{"is_focus":1,"user_info":{"userid":"13814","nickname":"没事改昵称"}}}
JSONPath 能做到判断 Data.user_info.userid 这个 key 如果存在的话返回 Data 的 value 吗 ?
应该怎么写呢,感谢各位
The text was updated successfully, but these errors were encountered: