2
回答
FastJson内部类反序列化问题
滴滴云服务器,限时包月0.9元,为开发者而生>>>   

@wenshao 你好,想跟你请教个问题:

以下为要JSON数据

{ "deliveryHists": [{ "delivery_status": "运单生成", "delivery_ts": "2015-12-14 19:25:14.0", "process_status": "01", "position_code": "SHANGHAI CHINA" }], "jp_express_section_id": "56148904000-56178953999", "sx_no": "20001512140002", "process_status": "01", "jp_express_no": "561489040081", "waybill_id": "20001512140002" }

以下为要反序列化的实体类

public class _WaybillTrackLogistics implements Serializable {
    private static final long serialVersionUID = -1761001774687429469L;
    private List<DeliveryHist> deliveryHists;

    public void setDeliveryHists(List<DeliveryHist> deliveryHists){
        this.deliveryHists = deliveryHists;
    }
    public List<DeliveryHist> getDeliveryHists(){
        return deliveryHists;
    }

    public class DeliveryHist {
        private String delivery_status;
        public void setDelivery_status(String delivery_status){
            this.delivery_status = delivery_status;
        }
        public String getDelivery_status(){
            return delivery_status;
        }

        private Date delivery_ts;
        public void setDelivery_ts(Date delivery_ts){
            this.delivery_ts = delivery_ts;
        }
        public Date getDelivery_ts(){
            return delivery_ts;
        }

        private String process_status;
        public void setProcess_status(String process_status){
            this.process_status = process_status;
        }
        public String getProcess_status(){
            return process_status;
        }

        private String position_code;
        public void setPosition_code(String position_code){
            this.position_code = position_code;
        }
        public String getPosition_code(){
            return position_code;
        }

    }
    private String jp_express_section_id;
    public void setJp_express_section_id(String jp_express_section_id){
        this.jp_express_section_id = jp_express_section_id;
    }
    public String getJp_express_section_id(){
        return jp_express_section_id;
    }

    private String sx_no;
    public void setSx_no(String sx_no){
        this.sx_no = sx_no;
    }
    public String getSx_no(){
        return sx_no;
    }

    private String process_status;
    public void setProcess_status(String process_status){
        this.process_status = process_status;
    }
    public String getProcess_status(){
        return process_status;
    }

    private String jp_express_no;
    public void setJp_express_no(String jp_express_no){
        this.jp_express_no = jp_express_no;
    }
    public String getJp_express_no(){
        return jp_express_no;
    }

    private String waybill_id;
    public void setWaybill_id(String waybill_id){
        this.waybill_id = waybill_id;
    }
    public String getWaybill_id(){
        return waybill_id;
    }
}



JSON的第一位数据为数组,这样就无法完成反序列化。不知为何。求解答。

举报
LeoHsu
发帖于2年前 2回/2K+阅
顶部