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

如何使用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日
  • 展开全部

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改