@Test
public void a(){
A a = new A();
String s = JSON.toJSONString(a);
System.out.println(s);
try {
A a1 = JSON.parseObject(s, A.class);
}catch (Exception e){
e.printStackTrace();
}
A a1 = new Gson().fromJson(s, A.class);
System.out.println(a1);
}
class A{
public Map<String, Object> getA() {
return a;
}
public void setA(Map<String, Object> a) {
this.a = a;
}
Map<String, Object> a = new HashMap<>();
按照上面的类, 可以用 fastjson序列化, 反序列化会报错.
gson可以处理成功.
case跟map无关,A上加statis即可
Most helpful comment
case跟map无关,A上加statis即可