jersist 2021-09-01 09:39 采纳率: 100%
浏览 276
已结题

如何使用SpringBoot解析JSON数组


{"errcode":0,"result":[{"check_date_time":"2021-08-27 17:57:30","check_status":"Checked","check_type":"OnDuty","corp_id":"ding7c748955d913770335c2f4657eb6378f","gmt_create":"2021-08-27 17:57:31","gmt_modified":"2021-08-27 17:57:31","group_id":-1,"id":235069117132,"is_rest":"N","real_plan_time":"2021-08-27 17:57:30","user_id":"242157225634238654","work_date":"2021-08-27 00:00:00"}],"success":true,"request_id":"8kus66o51zb2"}

之前的


{"errcode":0,"result":{"approve_list":[],"attendance_result_list":[{"check_type":"OffDuty","class_id":214655132,"group_id":240975087,"location_method":"ATM","location_result":"Normal","plan_check_time":"2021-07-14 17:00:00","plan_id":217863022888,"record_id":67835293281,"source_type":"ATM","time_result":"Normal","user_address":"前台","user_check_time":"2021-07-14 17:15:35"},{"check_type":"OnDuty","class_id":214655132,"group_id":240975087,"location_method":"ATM","location_result":"Normal","plan_check_time":"2021-07-14 08:00:00","plan_id":217863022887,"record_id":67956355229,"source_type":"ATM","time_result":"Normal","user_address":"前台","user_check_time":"2021-07-14 07:58:52"}],"check_record_list":[{"record_id":67835293281,"source_type":"ATM","user_check_time":"2021-07-14 17:15:35","valid_matched":true},{"record_id":67956355229,"source_type":"ATM","user_check_time":"2021-07-14 07:58:52","valid_matched":true}],"class_setting_info":{"rest_time_vo_list":[{"rest_begin_time":14400000,"rest_end_time":18000000}]},"corpId":"ding7c748955d913770335c2f4657eb6378f","userid":"51191","work_date":"2021-07-14 09:00:00"},"success":true,"request_id":"10hbita0g2902"}

然后用了两种办法,一种因为缺少Object名导致不知道怎么单独建list,从而无法反序列化。第二种直接创建LIST导致无法正常CAST

  • 写回答

4条回答 默认 最新

  • Silence丶你的名字 2021-09-01 09:50
    关注
    
    public class ToResultDTO {
        private Integer errcode;
        private ArrayList<Item> result;
        private String success;
        private String request_id;
    
        static class Item{
            private String check_date_time;
            private String check_status;
            private String check_type;
            private String corp_id;
            private String gmt_create;
            private String gmt_modified;
            private String group_id;
            private String id;
            private String is_rest;
            private String real_plan_time;
            private String user_id;
            private String work_date;
        }
    
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 9月9日
  • 已采纳回答 9月1日
  • 修改了问题 9月1日
  • 赞助了问题酬金 9月1日
  • 展开全部

悬赏问题

  • ¥15 VS2022 C++的相关代码问题咨询
  • ¥15 如果要做一个老年人平板有哪些需求
  • ¥15 k8s生产配置推荐配置及部署方案
  • ¥15 matlab提取运动物体的坐标
  • ¥15 人大金仓下载,有人知道怎么解决吗
  • ¥15 一个小问题,本人刚入门,哪位可以help
  • ¥30 python安卓开发
  • ¥15 使用R语言GD包一直不出结果
  • ¥15 计算机微处理器与接口技术相关问题,求解答图片的这个问题,有多少个端口,端口地址和解答问题的方法和思路,不要AI作答
  • ¥15 如何根据一个截图编写对应的HTML代码