fastjson Android syntax error, expect {, actual pos 40, json : {"errmsg":"","accessToken":"","result":[],"code":"0"}, fieldName result

6vl6ewon  于 2022-12-31  发布在  Android
关注(0)|答案(2)|浏览(136)

一天报了20次这个错误搞不懂啊温少

这是我的实体类

public class Invest {

public String accessToken;
public String code;
public String errmsg;

public ResultBean result;

public static class ResultBean {
    public AccountBean account;
    public double availableRed;
    public String canIncreaseInterest;
    public double expect;
    public int isNovice;//是否新手标
    public double money;
    public ProjectBean project;
    public String quickInverst;
    public String redEnvelopeRate;
    public List<IncreaseInterestListBean> increaseInterestList;
    public List<RedEnvelopeListBean> redEnvelopeList;

    public static class AccountBean {
        public String collect;
        public String frozen;
        public String repay;
        public String total;
        public String uid;
        public String usable;
    }

    public static class ProjectBean {
        public double addRate;
        public int cycle;
        public int cycleType;
        public String id;
        public String name;
        public String no;
        public String remainDays;
        public String scales;
        public String surplus;
        public String yearRate;
    }

    public static class IncreaseInterestListBean {
        public double amount;
        public String expiredTime;
        public String id;
        public String name;
        public String remark;
        public String state;
        public Object useTime;
        public String validTime;

        //自加字段
        public boolean isSelect;
    }

    public static class RedEnvelopeListBean {

        public double amount;
        public String expiredTime;
        public String id;
        public String name;
        public String remark;
        public String state;
        public Object useTime;
        public String validTime;
        //自加字段
        public boolean isSelect;
    }
}

}

调用的方法
Invest invest = com.alibaba.fastjson.JSONObject.parseObject(response.toString(), Invest.class);

报错1
syntax error, expect {, actual pos 51, json : {"accessToken":"","code":"0","errmsg":"","result":[]}, fieldName result

报错2
syntax error, expect {, actual pos 40, json : {"errmsg":"","accessToken":"","result":[],"code":"0"}, fieldName result

z2acfund

z2acfund1#

fastjson-1.1.52.android.jar

at0kjp5o

at0kjp5o2#

result应该是个对象,但是返回了一个数组

相关问题