android 中 JsonObjectRequest 和 JsonArrayRequest 的区别?

Diffrence between JsonObjectRequest & JsonArrayRequest in volley in android?

大家好,我正在使用 volley 向服务器发送请求。我正在向服务器发送一些参数并得到一个 json 数组和 json 对象作为响应。截至目前,我正在使用 JsonObjectRequest 自定义请求来获取 response.If 响应是 JsonArray 我得到 json 数组如果响应是 jsonObject 那么我得到 json object.So 我应该采用哪种方法来获得响应?

Following is the code for sending request 
public void sendData()
{
    RequestQueue que=Volley.newRequestQueue(this);
    Map<String, String> params = new HashMap<String, String>();
    params.put("fname",fname );
    params.put("lname",lname );
    params.put("email",email );
    params.put("pswd",password);


     final ProgressDialog dialog = new ProgressDialog(HealthCreateAccount.this);
     dialog.setTitle("Please Wait");
     dialog.setMessage("Creating Account..");
     dialog.setCancelable(false);
     dialog.show();

    CustomRequest jsObjRequest = new CustomRequest(Method.POST, url, params, new Response.Listener<JSONObject>() {

                @Override
                public void onResponse(JSONObject response)
                {
                    dialog.dismiss();
                    Toast.makeText(getApplicationContext(), response.toString(), Toast.LENGTH_SHORT).show();


                }
            }, new Response.ErrorListener() {

                @Override
                public void onErrorResponse(VolleyError response) {
                    dialog.dismiss();
                    Toast.makeText(getApplicationContext(), "Unable to Create Account!", Toast.LENGTH_SHORT).show();
                    Log.i("RAE",response.toString());
                }
            });
    que.add(jsObjRequest);

}

Json 对象 & Json 数组是类型请求。 Json 对象将尝试获取 json 数组,其中 json 对象将获取 json object.However 您可以使用 json 对象并创建一个 json json 对象中的数组。