java.lang.IllegalStateException:预期BEGIN_OBJECT但是BEGIN_ARRAY

时间:2018-04-20 17:58:59

标签: android retrofit retrofit2

以下是JSON数据的链接:

http://elearnup.com/ajax/classes

这是JSON使用retrofit访问Activity中的代码:

 private void getAllInputValue() {

        Log.d("checekntest", "getAllInputValue: checktest");

        Call<List<AllRespoClass>> allInputDataApiCall = apiGet.getDataInput();
        allInputDataApiCall.enqueue(new Callback<List<AllRespoClass>>() {

            @Override
            public void onResponse(Call<List<AllRespoClass>> call, Response<List<AllRespoClass>> response) {


                respo = response.body();

                Log.d("resposize", "onResponse: "+respo.get(0).getSubjectClassList().size());
//         
            }

            @Override
            public void onFailure(Call<List<AllRespoClass>> call, Throwable t) {

                Log.d("checkexcep", "onFailure: fail"+t);

            }
        });



    }

json响应失败的错误堆栈:

07-08 05:26:00.844 7386-7386/com.abgroup.elearnup D/checkexcep: onFailure: failcom.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 3 column 2525 path $[1].subjects[1].chapters

0 个答案:

没有答案