private static Map processJsonAsMap(JsonElement jsonElement, Class<?> mapClass, Class<?> valueClass) throws JsonException, IllegalAccessException, InstantiationException {
        Map map;
        if (mapClass.isInterface()) {
            if (mapClass.isAssignableFrom(HashMap.class)) map = new HashMap();
            else throw new JsonException("Unsupported collection type");
        } else map = (Map)mapClass.newInstance();

        try {
            Map<String, JsonElement> jsonMap = jsonElement.getData();
            if (jsonMap == null) return null;
            for (Map.Entry<String, JsonElement> entry : jsonMap.entrySet())
                map.put(entry.getKey(), getSubObject(jsonElement.get(entry.getKey()), valueClass));

            return map;
        } catch (ClassCastException e) {
            throw new JsonException("Class Cast Problem: " + e.getMessage());
        }
    }