如何在Android中解析JSON(我有一个不同的JSON格式)

时间:2015-06-24 04:40:22

标签: java android json parsing

这是我的json文件的样子:

{"GradeList": 
{"CODE":["012113001","00273011","040612003","090503012"],
"NAME":["Biology","Math","Physic","Reading I"],
"SECTION:["1","5","3","4"],
"GRADE":["B","A+","B+","B"}
}

我不知道如何在我的app中读取该数据。我无法更改数据。

1 个答案:

答案 0 :(得分:0)

我建议使用Gson库。

创建新类:

userid

然后:

public class GradeList {
    private Collection<String> CODE;
    private Collection<String> NAME;
    private Collection<String> SECTION;
    private Collection<String> GRADE;
}

有关GsonBuilder的更多信息,请访问here