我的json回复: -
{
"status": "ok",
"response": [
{
"years": [
{
"trackers": [
{
"uuid": "C8B907F3200A7C1417076FF84060340F2B1EF5BC858AD27B",
"curriculum": {
"name": "NAACE Computing",
"uuid": "ED4FD5452008EEF5DB663FA30939900F649302BCA34816CB"
},
"subject": {
"uuid": "91364ED12003103FC455BF3B2AC45F0F6387D3FC2A258A05",
"name": "Computing",
"source": "system",
"enabled": true
},
"group": {
"uuid": "E824756720013148C56DFFD7DD7A12021403CE0CEAB49ED2",
"name": "Class 1",
"type": "class",
"policy_priority": 6,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453189156,
"updated_by": null,
"updated_on": null,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 5
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
},
{
"uuid": "E85D0F4C200A79567716AFDCBE3AF404557C4C4CC1F56EB7",
"curriculum": {
"name": "Rising Stars Progression Framework",
"uuid": "ED5783F62008E54D3F9D5F8B48EE46058679BB9C0907BF8A"
},
"subject": {
"uuid": "91364ED12003103FC455BF3B2AC45F0F6387D3FC2A258A05",
"name": "Computing",
"source": "system",
"enabled": true
},
"group": {
"uuid": "EE093F3C20013BAF5B944FFCB2028602613D4CECD876FD34",
"name": "Class 2",
"type": "class",
"policy_priority": 5,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453125129,
"updated_by": null,
"updated_on": 1453189177,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 29
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
},
{
"uuid": "E86E8507200A77774147DF5DB7DBFC037DDC5D9CFEAF6C02",
"curriculum": {
"name": "Rising Stars Progression Framework",
"uuid": "ED5783F62008E54D3F9D5F8B48EE46058679BB9C0907BF8A"
},
"subject": {
"uuid": "91364EE520031CB80E753FE310D95207FE0C6B1CECB022E9",
"name": "Mathematics",
"source": "system",
"enabled": true
},
"group": {
"uuid": "EE093F3C20013BAF5B944FFCB2028602613D4CECD876FD34",
"name": "Class 2",
"type": "class",
"policy_priority": 5,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453125129,
"updated_by": null,
"updated_on": 1453189177,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 29
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
},
{
"uuid": "D1D509CC200A754C76FE0FC980F6DA0BE1AA7C8CA9BC0372",
"curriculum": {
"name": "Rising Stars Progression Framework",
"uuid": "ED5783F62008E54D3F9D5F8B48EE46058679BB9C0907BF8A"
},
"subject": {
"uuid": "A6C4DB8F200316613650CF995B835C06B47CA22CDAAC2F62",
"name": "Reading",
"source": "system",
"enabled": true
},
"group": {
"uuid": "EE093F3C20013BAF5B944FFCB2028602613D4CECD876FD34",
"name": "Class 2",
"type": "class",
"policy_priority": 5,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453125129,
"updated_by": null,
"updated_on": 1453189177,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 29
},
"created_by_uuid": "D185D3E3200058716235DFECB7C58C0604923B9CEBE14382"
},
{
"uuid": "1BD06054200A7043092FBFCF7AF9270FE4D0F1DC368AC671",
"curriculum": {
"name": "Rising Stars Progression Framework",
"uuid": "ED5783F62008E54D3F9D5F8B48EE46058679BB9C0907BF8A"
},
"subject": {
"uuid": "A6C4DB8F200316613650CF995B835C06B47CA22CDAAC2F62",
"name": "Reading",
"source": "system",
"enabled": true
},
"group": {
"uuid": "EE093F3C20013BAF5B944FFCB2028602613D4CECD876FD34",
"name": "Class 2",
"type": "class",
"policy_priority": 5,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453125129,
"updated_by": null,
"updated_on": 1453189177,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 29
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
},
{
"uuid": "E892B134200A70221D6EDF3A86D4B402511CFAAC917AC76E",
"curriculum": {
"name": "Rising Stars Progression Framework",
"uuid": "ED5783F62008E54D3F9D5F8B48EE46058679BB9C0907BF8A"
},
"subject": {
"uuid": "91364F1520031DB70162AFEE72134306E4B0D0CC582444B7",
"name": "Science",
"source": "system",
"enabled": true
},
"group": {
"uuid": "EE093F3C20013BAF5B944FFCB2028602613D4CECD876FD34",
"name": "Class 2",
"type": "class",
"policy_priority": 5,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453125129,
"updated_by": null,
"updated_on": 1453189177,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 29
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
},
{
"uuid": "E88226BA200A731A5E9B6F97C28F1F05A6499EBCA13400D1",
"curriculum": {
"name": "Rising Stars Progression Framework",
"uuid": "ED5783F62008E54D3F9D5F8B48EE46058679BB9C0907BF8A"
},
"subject": {
"uuid": "A6C4DB9E200311439945EF32051D26058C06563C5CA2D536",
"name": "Writing",
"source": "system",
"enabled": true
},
"group": {
"uuid": "EE093F3C20013BAF5B944FFCB2028602613D4CECD876FD34",
"name": "Class 2",
"type": "class",
"policy_priority": 5,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453125129,
"updated_by": null,
"updated_on": 1453189177,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 29
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
}
],
"year": {
"uuid": "E38D758920090CB38EBD5F151EBAEB0305DDD7CC4B0C6E2F",
"name": "Year 2"
}
},
{
"trackers": [
{
"uuid": "75B0C9D3200A716110AA4F882DC20A0BAC279B8CA0B0DFCD",
"curriculum": {
"name": "National Curriculum England 2014 - NAHT Assessment Framework",
"uuid": "70E1822E2008E7B3BC332F9D56873C0D010F0E7CC6A4BDF4"
},
"subject": {
"uuid": "91364E8D20031F44E5244F062C65370F4736605C0C4B293B",
"name": "Art and Design",
"source": "system",
"enabled": true
},
"group": {
"uuid": "EE093F3C20013BAF5B944FFCB2028602613D4CECD876FD34",
"name": "Class 2",
"type": "class",
"policy_priority": 5,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453125129,
"updated_by": null,
"updated_on": 1453189177,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 29
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
},
{
"uuid": "E936166D200A71020E0C0F1A02CE140A032E9D7C7AA84CEB",
"curriculum": {
"name": "Rising Stars Progression Framework",
"uuid": "ED5783F62008E54D3F9D5F8B48EE46058679BB9C0907BF8A"
},
"subject": {
"uuid": "91364EE520031CB80E753FE310D95207FE0C6B1CECB022E9",
"name": "Mathematics",
"source": "system",
"enabled": true
},
"group": {
"uuid": "E824756720013148C56DFFD7DD7A12021403CE0CEAB49ED2",
"name": "Class 1",
"type": "class",
"policy_priority": 6,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453189156,
"updated_by": null,
"updated_on": null,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 5
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
},
{
"uuid": "E912611D200A7B5484DDBF60A382A10023C5B81C92ACFD74",
"curriculum": {
"name": "Rising Stars Progression Framework",
"uuid": "ED5783F62008E54D3F9D5F8B48EE46058679BB9C0907BF8A"
},
"subject": {
"uuid": "A6C4DB8F200316613650CF995B835C06B47CA22CDAAC2F62",
"name": "Reading",
"source": "system",
"enabled": true
},
"group": {
"uuid": "E824756720013148C56DFFD7DD7A12021403CE0CEAB49ED2",
"name": "Class 1",
"type": "class",
"policy_priority": 6,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453189156,
"updated_by": null,
"updated_on": null,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 5
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
},
{
"uuid": "E922B061200A71FF5F850FB9F28D9001B4DC560C3E96BE13",
"curriculum": {
"name": "Rising Stars Progression Framework",
"uuid": "ED5783F62008E54D3F9D5F8B48EE46058679BB9C0907BF8A"
},
"subject": {
"uuid": "A6C4DB9E200311439945EF32051D26058C06563C5CA2D536",
"name": "Writing",
"source": "system",
"enabled": true
},
"group": {
"uuid": "E824756720013148C56DFFD7DD7A12021403CE0CEAB49ED2",
"name": "Class 1",
"type": "class",
"policy_priority": 6,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453189156,
"updated_by": null,
"updated_on": null,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 5
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
}
],
"year": {
"uuid": "E38D757D2009048C451F4F71C1554E0BADAC8F7C10B2EF1D",
"name": "Year 1"
}
},
{
"trackers": [
{
"uuid": "47415459200A73E5DF577F0EE2C03705D818E7AC62C37A1A",
"curriculum": {
"name": "National Curriculum England 2014 - NAHT Assessment Framework",
"uuid": "70E1822E2008E7B3BC332F9D56873C0D010F0E7CC6A4BDF4"
},
"subject": {
"uuid": "91364EAF20031403D0DDBF34E5065C0179757BCC6529343C",
"name": "English",
"source": "system",
"enabled": true
},
"group": {
"uuid": "EE093F3C20013BAF5B944FFCB2028602613D4CECD876FD34",
"name": "Class 2",
"type": "class",
"policy_priority": 5,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453125129,
"updated_by": null,
"updated_on": 1453189177,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 29
},
"created_by_uuid": "EC6B1208200057B15A57FFC60207C608CA49CB5CAC551610"
},
{
"uuid": "8D446D72200A763426C95F326D6F3F0B59D6201C13390095",
"curriculum": {
"name": "National Curriculum England 2014 - NAHT Assessment Framework",
"uuid": "70E1822E2008E7B3BC332F9D56873C0D010F0E7CC6A4BDF4"
},
"subject": {
"uuid": "91364EE520031CB80E753FE310D95207FE0C6B1CECB022E9",
"name": "Mathematics",
"source": "system",
"enabled": true
},
"group": {
"uuid": "EE093F3C20013BAF5B944FFCB2028602613D4CECD876FD34",
"name": "Class 2",
"type": "class",
"policy_priority": 5,
"users_read_only": false,
"roles_read_only": false,
"created_by": null,
"created_on": 1453125129,
"updated_by": null,
"updated_on": 1453189177,
"source": "local",
"group_members": [
],
"hidden": false,
"member_count": 29
},
"created_by_uuid": "AEBB466920005BA2486F0FC9F9AAC10FDF77900C90146CF6"
}
],
"year": {
"uuid": "E38D758E2009078124015F02F27693054195A99C4654BF09",
"name": "Year 3"
}
}
],
"curriculum_type": {
"uuid": "AA45156A200924C891166F202DA4960A661567FCF6016269",
"name": "Key Stages",
"path": "{\"curriculummanager\":\"year_group,subject,curriculum,subject_area\",\"reporting\":\"year_group,subject\",\"default\":\"year_group,year,subject,curriculum\"}",
"template": null,
"created_by": "ADE0C09320005574448F2F024A037A0FB20CDDCC0CCC88D9"
}
}
],
"request": {
"url": "\/studenttracker\/getBy",
"method": "get",
"headers": {
"Host": "future-demo.frogos.net",
"X-Was-SSL": "true",
"X-Forwarded-For": "203.34.117.5",
"Connection": "close",
"X-AuthType": "oauth_1_0_a",
"Accept": "application\/json",
"User-Agent": "FrogProgress\/39 (iPhone; iOS 9.1; Scale\/2.00)",
"Accept-Language": "en-US;q=1",
"Accept-Encoding": "*",
"Authorization": "OAuth oauth_consumer_key=\"4llu4nfocc6csgkkw84oso8w45tp0z7a\", oauth_nonce=\"845755EC- B33A-49B3-AE8F-45D58A4BCE92\", oauth_signature=\"5eQIBLO1OvPoLjwWYZCsSV4DfXk%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1457432571\", oauth_token=\"c85949b632ffde6804317ef17d8f098f8557da43\", oauth_version=\"1.0\""
},
"params": [
]
}
}
public class Tracker {
private Response response ;
private String status;
public String getStatus() {
return status;
}
public Response getResponse() {
return response;
}
public static class Response {
private CurriculamType curriculamType;
private List<Years> years;
public List<Years> getYears() {
return years;
}
public CurriculamType getCurriculamType() {
return curriculamType;
}
}
public static class CurriculamType{
private String name;
public String getName() {
return name;
}
}
public static class Years{
private List<Trackers> trackers;
public List<Trackers> getTrackers() {
return trackers;
}
}
public static class Trackers{
private List<Subject> subject ;
public List<Subject> getSubject() {
return subject;
}
}
public static class Subject{
private String name ;
private String source;
public String getName() {
return name;
}
public String getSource() {
return source;
}
}
}
TrackersAPI界面: -
public interface TrackersAPI {
@GET("/studenttracker/getBy")
public void getTrackers(Callback<Tracker> response);
}
RestAdapter: -
RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(ParserMethods.serverURL)
.setRequestInterceptor(requestInterceptor)
.build();
TrackersAPI api = adapter.create(TrackersAPI.class);
api.getTrackers(new Callback<Tracker>() {
@Override
public void success(Tracker trackers, Response response) {
loading.dismiss();
}
@Override
public void failure(RetrofitError error) {
//you can handle the errors here
Log.v("Error", error.toString());
}
});
我认为我的bean类中存在错误但无法找到解决方案。请帮忙!!
答案 0 :(得分:0)
您收到此错误,因为主题不是数组,它是您的跟踪器代码中的对象,您将其视为数组。
"subject": {
"uuid": "91364ED12003103FC455BF3B2AC45F0F6387D3FC2A258A05",
"name": "Computing",
"source": "system",
"enabled": true
},
使用以下代码替换您的跟踪器类主题,并希望它能正常工作。
private Subject subject ;
public Subject getSubject() {
return subject;
}