[QUESTION]JSONPath解析异常
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 请描述您的问题
*询问有关本项目的使用和其他方面的相关问题。*
//测试数据
String test = """
{
"1": {
"a1": [{"id":"a1"},{"id":"a2"}],
"b1": [{"id":"b1"},{"id":"b2"}]
},
"2": {
"a2": [{"id":"a1", "id1":"a11", "userId": "a12"},{"id":"a2"}],
"b2": [{"id":"b1"},{"id":"b2"}]
}
}
""";
String jsonPath = "$.*.*.*";
System.out.println("com.alibaba.fastjson2: " + JSONPath.eval(test, jsonPath));
//测试结果:[[{"id":"a1"},{"id":"a2"}],[{"id":"b1"},{"id":"b2"}],[{"id":"a1","id1":"a11","userId":"a12"},{"id":"a2"}],[{"id":"b1"},{"id":"b2"}]]
//期望结果:[{"id":"a1"},{"id":"a2"},{"id":"b1"},{"id":"b2"},{"id":"a1","id1":"a11","userId":"a12"},{"id":"a2"},{"id":"b1"},{"id":"b2"}]
Contributor guide
Research direction
Start by running the supplied Java example with JSONPath.eval and inspect the JSONPath wildcard traversal behavior. Confirm whether $.*.*.* should flatten the nested arrays, then add a regression test for the expected list of objects and verify the 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
- 30/100