Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

[bug] JSONPath.extract(str, "$.result[0,2].puid")解析异常 #3493

Open
huo-feng-ding opened this issue Oct 14, 2020 · 1 comment
Open

[bug] JSONPath.extract(str, "$.result[0,2].puid")解析异常 #3493

huo-feng-ding opened this issue Oct 14, 2020 · 1 comment
Labels

Comments

@huo-feng-ding
Copy link

{
"result": [
{
"puid": "21025318"
},
{
"puid": "21482682"
},
{
"puid": "21025345"
}
],
"state": 0
}

JSONPath.extract(str, "$.result[0,2].puid")报异常
java.lang.UnsupportedOperationException
at com.alibaba.fastjson.JSONPath$MultiIndexSegment.extract(JSONPath.java:2694)
at com.alibaba.fastjson.JSONPath.extract(JSONPath.java:179)
at com.alibaba.fastjson.JSONPath.extract(JSONPath.java:698)
at com.alibaba.fastjson.JSONPath.extract(JSONPath.java:704)

使用JSONPath.eval(jsonObject, "$.result[0,2].puid") 正常

@wenshao wenshao added the bug label Oct 21, 2020
@zhangshun2
Copy link

报的错是不支持这个操作啊.没实现的不算是bug把

limpidezza added a commit to limpidezza/fastjson that referenced this issue Oct 27, 2020
bug报告参见 alibaba#3493

修复之前,抛出异常UnsupportedOperationException

提交修复了这个问题,添加了MultiIndexSegment的类型判断,标志位eval置为true

提供了一个测试用例
limpidezza added a commit to limpidezza/fastjson that referenced this issue Oct 27, 2020
bug报告参见 alibaba#3493

修复之前,抛出异常UnsupportedOperationException

提交修复了这个问题,添加了MultiIndexSegment的类型判断,标志位eval置为true

提供了一个测试用例
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants