In my code I my a call to a service. from the returned json object I am interested in an object. this object is a json array. sometimes, depending on the provided info in the submit this json array object is empty or does not exist.

How can I check if the object in the json object is of type jsonarray before I create an object out from it?

```
JSONObject VODB = (JSONObject) JSONreturnObj.get("VODB");
 if (null != VODB.get("KNDV430")){
  if (VODB.getJSONArray("KNDV430") instanceof JSONArray){
   JSONArray KNDV430 = VODB.getJSONArray("KNDV430");
   customer.setCustResp((String) ((JSONObject)KNDV430.get(0)).get("responsible"));
 }
}

```

now I get a message in my server log:

org.json.JSONException: JSONObject["KNDV430"] is not a JSONArray.

which I want to avoid.

How should I adapt my code?