private static Object processJsonArrayAsCollection(JsonElement jsonElement, Class<?> parameterClass, Class<?> genericClass) throws JsonException, IllegalAccessException, InstantiationException {
        if (jsonElement.getType() != JsonType.ARRAY) throw new JsonException("Json Element is not Array");

        if (!Collection.class.isAssignableFrom(parameterClass)) throw new JsonException("Incompatible types");

        Collection newCollection;
        if (parameterClass.isInterface()) {
            if (parameterClass.isAssignableFrom(ArrayList.class)) newCollection = new ArrayList();
            else throw new JsonException("Unsupported collection type");
        } else newCollection = (Collection)parameterClass.newInstance();

        Iterator<JsonElement> it = jsonElement.iterator();
        while (it.hasNext()) newCollection.add(getSubObject(it.next(), genericClass));

        return newCollection;
    }