You can look at example in Fastjson library
Encode
import com.alibaba.fastjson.JSON;
Group group = new Group();
group.setId(0L);
group.setName("admin");
User guestUser = new User();
guestUser.setId(2L);
guestUser.setName("guest");
User rootUser = new User();
rootU...
Code
Group group = new Group();
group.setId(1);
group.setName("Ke");
User user1 = new User();
user1.setId(2);
user1.setName("Liu");
User user2 = new User();
user2.setId(3);
user2.setName("Yue");
...