[BUG] fastjson2中jsonpath表达式嵌套执行报错
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
fastjson版本:2.0.43,场景:检索某个路径下的某个字段,在另外一个jsonpath的取值范围
表达式:$.person[?(@.city in $.city)]
demo:
String testJson = "{\"city\":[\"shanxi\",\"heilongjiang\"],\"person\":[{\"name\":\"dongxp\",\"city\":\"shanxi\"},{\"name\":\"dongxp\",\"city\":\"heilongjiang\"}]}";
JSONObject json1 = JSONObject.parseObject(testJson);
Object results1 = JSONPath.eval(json1, "$.person[?(@.city in $.city)]");
执行结果:

期望:同jayway的jsonpath一样,可以正常执行获取结果

Contributor guide
Research direction
Start at the JSONPath.eval entry point and reproduce the issue with the supplied JSON and expression $.person[?(@.city in $.city)]. Trace the nested JSONPath lookup and add or update a focused test if the project has one; done means the expression returns both matching person objects, as in the Jayway JSONPath result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100