fastjson2
fastjson2 copied to clipboard
json字符串转ConcurrentLinkedQueue时,含"$ref"会报错
环境信息
- OS信息: window7
- JDK信息:Openjdk 11
- 版本信息:Fastjson2 2.0.50
String json = "[{\"a\":998982405},{\"a\":998992165},{\"$ref\":\"$[1]\"}]"; ConcurrentLinkedQueue<Map> list= JSON.parseObject(json, new TypeReference<ConcurrentLinkedQueue<Map>>(){});
报错: 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是不报错的。