1. About inheritance
The inheritance structure of the class is
class Base{ private int id; public Long getId() { return id; } public void setId(Long id) { = id; } } class User extends Base{ private String name; public String getName() { return name; } public void setName(String name) { = name; } } class UserVO{ public User user; }
If you do not add the get/set method to user in UserVO, just set the access permission to public. When using fastjson formatting, the user object in UserVO will not get the id in the base class base
2. About ArrayList
If a class exists, the type of list is ArrayList
class UserVO{ public ArrayList<User> list; }
The following error will appear when converting to json
: create asm serilizer error, class class JSONobject
The above article discusses two issues when fastjson formats objects into json in detail are all the content I share with you. I hope you can give you a reference and I hope you support me more.