1

如何使用Google Json解析以下响应?

{
"code": 1,
"data": {
    "0": {
        "name": "test",
        "expirationDate": "-1",
        "masterDate": "31\/5\/2013",            
    },
    "message": "my message"
}
}

我试过这个......

public class Test {

public int code;
public Data data;

public class Data {
    @SerializedName("0")
    public Promo customName;
}

public class Promo {
    public String name;
    public String expirationDate;
    public String masterDate;       
}

它不工作。

4

1 回答 1

0

您的Data班级缺少message变量:

public class Data {
    @SerializedName("0")
    public Promo customName;

    public String message;
}
于 2013-05-11T07:51:09.067 回答