src/main/java/org/semgus/java/util/JsonUtils.java
@SuppressWarnings("unchecked")
    public static List<JSONObject> ensureObjects(JSONArray arr) throws DeserializationException {
        for (int i = 0; i < arr.size(); i++) {
            if (!(arr.get(i) instanceof JSONObject)) {
                throw getTypeError(i, "an object", arr.get(i));
            }
        }
        return (List<JSONObject>)arr;
    }
/**
     * Asserts that a JSON array contains only JSON objects.
     *
     * @param arr The JSON array.
     * @return The array coerced to a list of JSON objects.
     * @throws DeserializationException If {@code arr} is not an array of JSON objects.
     */
Asserts that a JSON array contains only JSON objects.
@param arr The JSON array.
@return The array coerced to a list of JSON objects.
@throws DeserializationException If  arr is not an array of JSON objects.
Asserts that a JSON array contains only JSON objects . @param arr The JSON array . @return The array coerced to a list of JSON objects . @throws DeserializationException If arr is not an array of JSON objects .
@SuppressWarnings("unchecked")
    public static List<JSONObject> ensureObjects(JSONArray arr) throws DeserializationException {
        for (int i = 0; i < arr.size(); i++) {
            if (!(arr.get(i) instanceof JSONObject)) {
                throw getTypeError(i, "an object", arr.get(i));
            }
        }
        return (List<JSONObject>)arr;
    }
@ SuppressWarnings ( "unchecked" ) public static List < JSONObject > ensureObjects ( JSONArray arr ) throws DeserializationException { for ( int i = 0 ; i < arr . size ( ) ; i ++ ) { if ( ! ( arr . get ( i ) instanceof JSONObject ) ) { throw getTypeError ( i , "an object" , arr . get ( i ) ) ; } } return ( List < JSONObject > ) arr ; }
Asserts that a JSON array contains only JSON objects.
Asserts that a JSON array contains only JSON objects .