如何从 API 的 JSON 数组中获取没有名称的 JSON 对象

How can I get a JSON object without a name inside a JSON Array from API

the JSON data from the API I'm using

部分代码:我已经在代码中指出了,但我不确定该放什么: JSONObject volumeObj = itemsObj.getJSONObject("");基于那个 API 的“ ”里面。我可以在代码中修改什么或在“ ”中放入什么,以便让我从 {0}、{1} 等中获取对象?

 RequestQueue queue = Volley.newRequestQueue(MainActivity.this);


    // below line is use to make json object request inside that we
    // are passing url, get method and getting json object. .
    JsonObjectRequest booksObjrequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {
            progressBar.setVisibility(View.GONE);
            // inside on response method we are extracting all our json data.
            try {
                JSONArray itemsArray = response.getJSONArray("result");
                for (int i = 0; i < itemsArray.length(); i++) {
                    JSONObject itemsObj = itemsArray.getJSONObject(i);
                    **JSONObject volumeObj = itemsObj.getJSONObject("");**
                    String title = volumeObj.optString("title");
                    String subtitle = volumeObj.optString("subtitle");
                    JSONArray authorsArray = volumeObj.getJSONArray("authors");
                    String publisher = volumeObj.optString("publisher");
                    String publishedDate = volumeObj.optString("publishedDate");
                    String description = volumeObj.optString("description");

您是要获取数组的元素吗? “结果”数组包含这些对象,因此您可以使用索引访问它们:

for (int i = 0; i < itemsArray.length(); i++) {
    /* This is the ith object in the array */
    JSONObject volumeObj = itemsArray.getJSONObject(i);
    String title = volumeObj.optString("title");
    String subtitle = volumeObj.optString("subtitle");
    JSONArray authorsArray = volumeObj.getJSONArray("authors");
    String publisher = volumeObj.optString("publisher");
    String publishedDate = volumeObj.optString("publishedDate");
    String description = volumeObj.optString("description");
    ...
}