public class TestGSON {
@Test
public void testObjectToJSON() {
List<Student> list = new ArrayList<Student>();
Student s = new Student();
Student s3 = new Student();
s.setName("张三");
s.setSex("男");
s3.setName("李四");
s3.setSex("男");
list.add(s)
使用gson-2.2.4.jar来处理json数据
![](https://img-home.csdnimg.cn/images/20240711042549.png)