Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

json字符串转ConcurrentLinkedQueue时,含"$ref"会报错 #2602

Closed
156370005 opened this issue May 21, 2024 · 2 comments
Closed

json字符串转ConcurrentLinkedQueue时,含"$ref"会报错 #2602

156370005 opened this issue May 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working fixed
Milestone

Comments

@156370005
Copy link

156370005 commented May 21, 2024

环境信息

  • OS信息: window7
  • JDK信息:Openjdk 11
  • 版本信息:Fastjson2 2.0.50

String json = "[{\"a\":998982405},{\"a\":998992165},{\"$ref\":\"$[1]\"}]";
ConcurrentLinkedQueue list= JSON.parseObject(json, new TypeReference<ConcurrentLinkedQueue>(){});

报错:
Exception in thread "main" com.alibaba.fastjson2.JSONException: jsonpath not support operate : $[1], objectClassjava.util.concurrent.ConcurrentLinkedQueue
at com.alibaba.fastjson2.JSONPathSegmentIndex.eval(JSONPathSegmentIndex.java:157)
at com.alibaba.fastjson2.JSONPathSingleIndex.eval(JSONPathSingleIndex.java:33)
at com.alibaba.fastjson2.JSONReader.handleResolveTasks(JSONReader.java:319)
at com.alibaba.fastjson2.JSON.parseObject(JSON.java:993)

如果将ConcurrentLinkedQueue换成List,是不报错的。
fastjson1使用ConcurrentLinkedQueue是不报错的。

@156370005 156370005 added the bug Something isn't working label May 21, 2024
@yanxutao89 yanxutao89 self-assigned this May 21, 2024
@wenshao wenshao added this to the 2.0.51 milestone May 21, 2024
@wenshao wenshao added the fixed label May 21, 2024
@wenshao
Copy link
Member

wenshao commented May 21, 2024

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.51-SNAPSHOT/
问题已修复,请帮忙用2.0.51-SNAPSHOT版本验证

@wenshao
Copy link
Member

wenshao commented Jun 1, 2024

https://github.com/alibaba/fastjson2/releases/tag/2.0.51
问题已修复,请用新版本

@wenshao wenshao closed this as completed Jun 1, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants