1.首先需要一个实体

@Data
@Getter
@Setter
public class Entity
{
  private int id;
  private String name;

}

2.然后就是进行转换的逻辑

1、主流转换方法
JSONArray array = JSONArray.fromObject (jsonObject.get ("data")); //其中的这个data是接口传来的json数据 List <Entity> entityList = JSONArray.toList (array, new Entity (), new JsonConfig ())
2.过时的方法
List<Person> list = JSONArray.toList(array, Entity.class);// 过时方法

 

相关文章:

  • 2021-09-14
  • 2022-01-19
  • 2022-12-23
  • 2022-01-07
  • 2021-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-18
  • 2022-01-12
  • 2022-12-23
相关资源
相似解决方案