gpt4 book ai didi

android - Retrofit 如何解析没有对象名称的数组?

转载 作者:搜寻专家 更新时间:2023-11-01 07:49:04 25 4
gpt4 key购买 nike

    [
{
"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"
}
]

如何在 retrofit 1.9 中解析该类型的响应给我一些提示?

最佳答案

我假设您的 api 以对象数组响应,并且您想为此获得回调。你可以这样做,

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

学校类(class)在哪里,

public class School {
String schoolId;
String name;
}

关于android - Retrofit 如何解析没有对象名称的数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38025152/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com