json字符串转化成对象列表数据
json字符串转化成对象列表数据
public static void main(String[] args) { List<Test> list = new ArrayList<>(); for (int i = 0; i < 7000; i++) { Test test = new Test(); test.setCompId("11111"); test.setSeriesName("2000000"); test.setCompName("222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"); list.add(test); } String json = JSON.toJSONString(list); System.out.println(json); List<Test> rulesList = JSON.parseArray(json, Test.class); System.out.println("------------------------------------------------------------------------------------------------------------------"); for(Test r1:rulesList){ System.out.println(r1.toString()); } System.out.println("------------------------------------------------------------------------------------------------------------------"); }