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日
  • 展开全部

悬赏问题

  • ¥45 工程软件单片机设计课题要求
  • ¥15 在centos7安装conda
  • ¥15 c#调用yolo3 dll文件获取的数据对不上
  • ¥20 WPF 如何实现多语言,label 和cs(live Charts)中是否都能翻译
  • ¥15 STM32F103上电短路问题
  • ¥15 关于#单片机#的问题:以ATMEGA128或相近型号单片机为控制器设计直流电机调速的闭环控制系统(相关搜索:设计报告|软件设计|流程图)
  • ¥15 打开软件提示错误:failed to get wglChoosePixelFormatARB
  • ¥15 (标签-python|关键词-char)
  • ¥15 python+selenium,在新增时弹出了一个输入框
  • ¥15 苹果验机结果的api接口哪里有??单次调用1毛钱及以下。