使用Retrofit解析数组内部的动态数组

时间:2015-09-10 06:21:50

标签: android parsing retrofit

我正在尝试使用 Retrofit 解析数据结构,该动态数组集合在另一个动态数组集合中。

模型类是否正常或服务器响应是否存在问题?

结构#

{
  "DATA": {
    "2015": [
      [

      ],
      [

      ],
      [

      ],
      [

      ],
      [

      ],
      [
        {
          "fAmount": "1000",
          "paydate": "07\/29\/2015",
          "vName": "Mr. mule",
          "vPropertyStreet": "Street light",
          "vPropertyState": "test2",
          "vPropertyZipcode": "2222222",
          "vPropertyCity": "test2",
          "type": "Credit",
          "vPdfURL": "url"
        },
        {
          "fAmount": "1000",
          "paydate": "07\/29\/2015",
          "vName": "new",
          "vPropertyStreet": "Street light",
          "vPropertyState": "test2",
          "vPropertyZipcode": "2222222",
          "vPropertyCity": "test2",
          "type": "Charge",
          "vPdfURL": "url"
        },
        {
          "fAmount": "1000",
          "paydate": "07\/29\/2015",
          "vName": "Mr. mule",
          "vPropertyStreet": "Street light",
          "vPropertyState": "test2",
          "vPropertyZipcode": "2222222",
          "vPropertyCity": "test2",
          "type": "Credit",
          "vPdfURL": "url"
        }
      ],
      [

      ],
      [

      ],
      [

      ],
      [

      ],
      [

      ],
      [

      ]
    ]
  },
  "SUCCESS": 1
}

错误#

  

com.google.gson.JsonSyntaxException:java.lang.IllegalStateException:预期BEGIN_OBJECT

试过#

public class DataModelUserStatement {
    @SerializedName("DATA")
    Map<String, List<DataModelUserStatementSub>> types;

    Integer SUCCESS;

    String MESSAGE;

    public Map<String, List<DataModelUserStatementSub>> getTypes() {
        return types;
    }

    public void setTypes(Map<String, List<DataModelUserStatementSub>> types) {
        this.types = types;
    }

    public Integer getSUCCESS() {
        return SUCCESS;
    }

    public void setSUCCESS(Integer SUCCESS) {
        this.SUCCESS = SUCCESS;
    }

    public String getMESSAGE() {
        return MESSAGE;
    }

    public void setMESSAGE(String MESSAGE) {
        this.MESSAGE = MESSAGE;
    }
}
 public class DataModelUserStatementSub {
        Map<String, List<Type>> types;


        public Map<String, List<Type>> getTypes() {
            return types;
        }

        public void setTypes(Map<String, List<Type>> types) {
            this.types = types;
        }
    }
public class Type {
    @SerializedName("fAmount") private String fAmount;
    @SerializedName("paydate") private String paydate;
    @SerializedName("vName") private String vName;
    @SerializedName("vPropertyStreet") private String vPropertyStreet;
    @SerializedName("vPropertyState") private String vPropertyState;
    @SerializedName("vPropertyZipcode") private String vPropertyZipcode;
    @SerializedName("vPropertyCity") private String vPropertyCity;
    @SerializedName("type") private String type;
    @SerializedName("vPdfURL") private String vPdfURL;


    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getvPdfURL() {
        return vPdfURL;
    }

    public void setvPdfURL(String vPdfURL) {
        this.vPdfURL = vPdfURL;
    }

    public String getfAmount() {
        return fAmount;
    }

    public void setfAmount(String fAmount) {
        this.fAmount = fAmount;
    }

    public String getPaydate() {
        return paydate;
    }

    public void setPaydate(String paydate) {
        this.paydate = paydate;
    }

    public String getvName() {
        return vName;
    }

    public void setvName(String vName) {
        this.vName = vName;
    }

    public String getvPropertyStreet() {
        return vPropertyStreet;
    }

    public void setvPropertyStreet(String vPropertyStreet) {
        this.vPropertyStreet = vPropertyStreet;
    }

    public String getvPropertyState() {
        return vPropertyState;
    }

    public void setvPropertyState(String vPropertyState) {
        this.vPropertyState = vPropertyState;
    }

    public String getvPropertyZipcode() {
        return vPropertyZipcode;
    }

    public void setvPropertyZipcode(String vPropertyZipcode) {
        this.vPropertyZipcode = vPropertyZipcode;
    }

    public String getvPropertyCity() {
        return vPropertyCity;
    }

    public void setvPropertyCity(String vPropertyCity) {
        this.vPropertyCity = vPropertyCity;
    }
}

0 个答案:

没有答案