java obj 转 list ,数据类型为自定义对象
public static List<ContractModel> objToList(Object obj){ List<ContractModel> result = new ArrayList<ContractModel>(); try { ObjectMapper objectMapper = new ObjectMapper(); if (obj instanceof ArrayList<?>) { for (Object o : (List<?>) obj) { result.add(objectMapper.convertValue( o,ContractModel.class)); } } }catch (Exception e){ e.printStackTrace(); } return result; }