错误:预计BEGIN_ARRAY但是BEGIN_OBJECT

时间:2016-05-29 14:20:35

标签: android-studio android gson

  

处理:com.example.venky.httpurl1,PID:2578                                                                             java.lang.RuntimeException:com.google.gson.JsonSyntaxException:java.lang.IllegalStateException:预期为BEGIN_ARRAY,但在第1行第3列路径为BEGIN_OBJECT $ [0]

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    listView = (ListView) findViewById(R.id.rtlist);
    client = new AsyncHttpClient();
    client.get(MainActivity.this, url, new com.loopj.android.http.AsyncHttpResponseHandler() {
        @Override
        public void onSuccess(int statusCode, cz.msebera.android.httpclient.Header[] headers, byte[] responseBody) {
            String responsestr = new String(responseBody);
            gson = new Gson();
            responseObj = gson.fromJson(responsestr, Response.class);
            adapter = new CustomAdapter(MainActivity.this, responseObj);
            listView.setAdapter(adapter);
        }

任何输入请? 是因为我的JSON数据吗?

0 个答案:

没有答案