Skip to content
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多条件筛选语法报不合法语法 #2792

Closed
kevlxy opened this issue Sep 30, 2019 · 3 comments
Closed

jsonpath多条件筛选语法报不合法语法 #2792

kevlxy opened this issue Sep 30, 2019 · 3 comments
Milestone

Comments

@kevlxy
Copy link

kevlxy commented Sep 30, 2019

大佬您好,使用fastjson的时候发现一个问题,
jsonpath多条件筛选表达式报不合法语法,此表达式在其他在线测试网站可以使用。
具体信息如下:
fastjson版本:
1.2.60

jsonpath:
$.sku[?((@.quantity != 0)&&(@.is_onsale == 1))].sku_id

运行时报错:
Exception in thread "main" com.alibaba.fastjson.JSONPathException: illeal jsonpath syntax. $.sku[?((@.quantity != 0)&&(@.is_onsale == 1))].sku_id
at com.alibaba.fastjson.JSONPath$JSONPathParser.readName(JSONPath.java:1584)
at com.alibaba.fastjson.JSONPath$JSONPathParser.parseArrayAccessFilter(JSONPath.java:813)
at com.alibaba.fastjson.JSONPath$JSONPathParser.parseArrayAccess(JSONPath.java:786)
at com.alibaba.fastjson.JSONPath$JSONPathParser.readSegement(JSONPath.java:759)
at com.alibaba.fastjson.JSONPath$JSONPathParser.explain(JSONPath.java:1648)
at com.alibaba.fastjson.JSONPath.init(JSONPath.java:61)
at com.alibaba.fastjson.JSONPath.eval(JSONPath.java:71)
at com.alibaba.fastjson.JSONPath.eval(JSONPath.java:455)

其他工具成功使用截图:
image

@kimmking
Copy link
Contributor

kimmking commented Oct 1, 2019

@wenshao 我们是不是还不支持这种复杂的语法?

@wenshao wenshao closed this as completed in eea1d14 Oct 3, 2019
@wenshao wenshao added this to the 1.2.62 milestone Oct 3, 2019
@shaungquan
Copy link

这个解决了吗?

@leaderMaster
Copy link

$.sku[?(@.quantity != 0&&@.is_onsale == 1)].sku_id 改成这样试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants