alibaba / alibaba/fastjson2

[BUG] support deserialize exception?

Open
#3,177 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

### code
```
public class TestException extends Exception {
public TestException(String message) {
super(message);
}

public static void main(String[] args) {
Exception e = new TestException("test");
byte[] bytes = JSONB.toBytes(e);
Exception newer = JSONB.parseObject(bytes, TestException.class);
System.out.println(newer.getMessage());
}
}
```
then `com.alibaba.fastjson2.JSONException: fieldName not support input type TYPED_ANY -110, offset 1`

Contributor guide

Open the contributing guide

Research direction

Start with JSONB.toBytes and JSONB.parseObject in the supplied Java reproduction, then trace the TYPED_ANY handling reported at offset 1. Done means the TestException round trip succeeds and prints its message without JSONException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.