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("------------------------------------------------------------------------------------------------------------------");
    }

  

posted on 2021-03-12 13:42  lewisat  阅读(300)  评论(0编辑  收藏  举报

导航