[QUESTION]如何处理复杂对象的反序列化
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
###序列化复杂嵌套对象时,对象内含有抽象类和不可变元祖!
例如:private LinkedHashMap> path = Maps.newLinkedHashMapWithExpectedSize(16);
报错:com.alibaba.fastjson2.JSONException: TODO : OBJECT -90
###Fastjson2如何设置反序列化自定义解析器?
FastJosn有ObjectDeserialize,但是FastJson2通过
` public static class LinkedHashMapStringPairReader implements ObjectReader>> {}
static{
JSONFactory.getDefaultObjectReaderProvider().register(new TypeReference>>(){}.getType(), new GridStructFastJsonDeserializer.LinkedHashMapStringPairReader());
}
`
这种方式不生效
Contributor guide
Research direction
Start with the reported LinkedHashMap> type, the OBJECT -90 exception, and the ObjectReader registration snippet. Trace how JSONFactory.getDefaultObjectReaderProvider().register(...) resolves that TypeReference and compare it with Fastjson2's deserialization path; done means the nested object can be deserialized without the exception or the supported approach is clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100