code: public static boolean allJSONObjects(JSONArray array) throws JSONException {
          for (int i = 0; i < array.length(); ++i) {
              if (!(array.get(i) instanceof JSONObject)) {
                  return false;
              }
          }
          return true;
      }
docs: Returns whether all elements in {@code array} are {@link JSONObject} instances.
  
  @param array the array to inspect
  @return true if all the elements in the given array are JSONObjects
  @throws JSONException JSON parsing error