改造如何解析没有对象名称的数组?

时间:2016-06-25 05:04:12

标签: android retrofit

    [
  {
    "school_id": "1",
    "name": "Air University"
  },
  {
    "school_id": "2",
    "name": "Alabama A&M University"
  },
  {
    "school_id": "3",
    "name": "Alabama State University"
  },
  {
    "school_id": "4",
    "name": "Amridge University"
  },
  {
    "school_id": "5",
    "name": "Athens State University"
  },
  {
    "school_id": "6",
    "name": "Auburn University"
  }
]

如何在改造版1.9中解析该类型响应给我一些提示?

1 个答案:

答案 0 :(得分:4)

我假设你的api用一系列对象做出响应,你想得到一个回调。你可以这样做,

@GET('your url')
void getSchools(Callback<ArrayList<School>> callback);

学校班级在哪里,

public class School {
    String schoolId;
    String name;
}