How to check whether an element is a JSONArray or JSONObject. I wrote the code to check,
if(jsonObject.getJSONObject("Category").getClass().isArray()) {
} else {
}
In this case if the element 'category' is JSONObject then it work fine but if it contains an array then it throw exception: JSONArray cannot be converted to JSONObject. Please help. Thanks.