王学岗gson解析出错

解析json一直报错,这个异常Expected ?but was ?,查看了下返回的数据格式,发现服务器返回的数据格式不正确:
返回的数据:
{"code":200,"message":"OK","data":{"order_type_nid":"order_extra_service_free","extra":[],"report":[],"loan":[],"extra_free_product":[{"logo":"https://app.haoshijinfu.com/img/cost/icon_recommend.png","name":"借款 1000元/7天","remark":"放款快,周期长,利率低","price":"0.00","old_price":"88.00"}]},"error_code":0,"error_message":"","time":"2019-01-25 14:47:46"}
修改为:
{"code":200,"message":"OK","data":{"order_type_nid":"order_extra_service_free","extra":null,"report":null,"loan":null,"extra_free_product":[{"logo":"https://app.haoshijinfu.com/img/cost/icon_recommend.png","name":"借款 1000元/7天","remark":"放款快,周期长,利率低","price":"0.00","old_price":"88.00"}]},"error_code":0,"error_message":"","time":"2019-01-25 16:01:05"}
记着让后台把"extra":[],"report":[],"loan":[]修改为"extra":null,"report":null,"loan":null;不然你都不知道自己是怎么死的,就这个问题,马丹折磨了我一上午
这是实体类
``
public class OrderInfoDetailEntity {
private String order_type_nid;//订单类型
private LoanEntity loan;//免费订单
private ExtraEntity extra;//增值订单
private ReportEntity report;//报告订单
private List extra_free_product;

public String getOrder_type_nid() {
    return order_type_nid;
}

public void setOrder_type_nid(String order_type_nid) {
    this.order_type_nid = order_type_nid;
}

public LoanEntity getLoan() {
    return loan;
}

public void setLoan(LoanEntity loan) {
    this.loan = loan;
}

public ExtraEntity getExtra() {
    return extra;
}

public void setExtra(ExtraEntity extra) {
    this.extra = extra;
}

public ReportEntity getReport() {
    return report;
}

public void setReport(ReportEntity report) {
    this.report = report;
}

public List getExtra_free_product() {
    return extra_free_product;
}

public void setExtra_free_product(List extra_free_product) {
    this.extra_free_product = extra_free_product;
}

public static class Extra_free_product{
    private String logo;
    private String name;
    private String remark;
    private String price;
    private String old_price;

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getOld_price() {
        return old_price;
    }

    public void setOld_price(String old_price) {
        this.old_price = old_price;
    }
}

public static class LoanEntity{
    private String amount;
    private String order_no;
    private String status;
    private String create_at;
    private String push_status;
    private String expired_time;
    private String term;

    public String getTerm() {
        return term;
    }

    public void setTerm(String term) {
        this.term = term;
    }

    public String getExpired_time() {
        return expired_time;
    }

    public void setExpired_time(String expired_time) {
        this.expired_time = expired_time;
    }

    public String getAmount() {
        return amount;
    }

    public void setAmount(String amount) {
        this.amount = amount;
    }

    public String getOrder_no() {
        return order_no;
    }

    public void setOrder_no(String order_no) {
        this.order_no = order_no;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getCreate_at() {
        return create_at;
    }

    public void setCreate_at(String create_at) {
        this.create_at = create_at;
    }

    public String getPush_status() {
        return push_status;
    }

    public void setPush_status(String push_status) {
        this.push_status = push_status;
    }

    @Override
    public String toString() {
        return "LoanEntity{" +
                "amount='" + amount + '\'' +
                ", order_no='" + order_no + '\'' +
                ", status='" + status + '\'' +
                ", create_at='" + create_at + '\'' +
                ", push_status='" + push_status + '\'' +
                ", expired_time='" + expired_time + '\'' +
                ", term='" + term + '\'' +
                '}';
    }
}

public static class ExtraEntity{
    private String amount;
    private String status;
    private String term;
    private String stop_time;
    private List borrow;
    private List confirm;

    public String getAmount() {
        return amount;
    }

    public void setAmount(String amount) {
        this.amount = amount;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getTerm() {
        return term;
    }

    public void setTerm(String term) {
        this.term = term;
    }

    public String getStop_time() {
        return stop_time;
    }

    public void setStop_time(String stop_time) {
        this.stop_time = stop_time;
    }

    public List getBorrow() {
        return borrow;
    }

    public void setBorrow(List borrow) {
        this.borrow = borrow;
    }

    public List getConfirm() {
        return confirm;
    }

    public void setConfirm(List confirm) {
        this.confirm = confirm;
    }

    @Override
    public String toString() {
        return "ExtraEntity{" +
                "amount='" + amount + '\'' +
                ", status='" + status + '\'' +
                ", term='" + term + '\'' +
                ", stop_time='" + stop_time + '\'' +
                ", borrow=" + borrow +
                ", confirm=" + confirm +
                '}';
    }

    public static class BorrowEntity{
        private String ext_prod_name;
        private String logo;
        private String url;
        private String money_limit;

        public String getExt_prod_name() {
            return ext_prod_name;
        }

        public void setExt_prod_name(String ext_prod_name) {
            this.ext_prod_name = ext_prod_name;
        }

        public String getLogo() {
            return logo;
        }

        public void setLogo(String logo) {
            this.logo = logo;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getMoney_limit() {
            return money_limit;
        }

        public void setMoney_limit(String money_limit) {
            this.money_limit = money_limit;
        }

        @Override
        public String toString() {
            return "BorrowEntity{" +
                    "platform_name='" + ext_prod_name + '\'' +
                    ", logo='" + logo + '\'' +
                    ", url='" + url + '\'' +
                    ", money_limit='" + money_limit + '\'' +
                    '}';
        }
    }
    public static class ConfirmEntity{
        private String time;
        private String remark;
        private String status;

        public String getTime() {
            return time;
        }

        public void setTime(String time) {
            this.time = time;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        @Override
        public String toString() {
            return "ConfirmEntity{" +
                    "time='" + time + '\'' +
                    ", remark='" + remark + '\'' +
                    ", status='" + status + '\'' +
                    '}';
        }
    }
}
public static class ReportEntity{
    private String amount;
    private String order_no;
    private String status;
    private String create_at;
    private String url;

    public String getAmount() {
        return amount;
    }

    public void setAmount(String amount) {
        this.amount = amount;
    }

    public String getOrder_no() {
        return order_no;
    }

    public void setOrder_no(String order_no) {
        this.order_no = order_no;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getCreate_at() {
        return create_at;
    }

    public void setCreate_at(String create_at) {
        this.create_at = create_at;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}

}

``

你可能感兴趣的:(王学岗gson解析出错)