Skip to content

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

@156370005

Description

@156370005

环境信息

  • 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是不报错的。

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixed

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions