You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 23, 2024. It is now read-only.
public class Aa extends Exception {
public Aa(){
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public class C {
private Exception e;
public Exception getE() {
return e;
}
public void setE(Exception e) {
this.e = e;
}
}
Aa aa = new Aa();
aa.setName("aa");
C c = new C();
c.setE(aa);
String jsonC = JSON.toJSONString(c, SerializerFeature.WriteClassName);
C c2 = JSON.parseObject(jsonC, C.class);
System.out.println(c2.getE().getClass().getSimpleName());
System.out.println(((Aa)c2.getE()).getName());
结果为
Aa null