} else if (result.getClass().isArray()) {
map.put(key, new JsonArray(result, includeSuperClass));
} else if (result instanceof Collection<?>) { // List or Set
map.put(key, new JsonArray((Collection<?>) result, includeSuperClass));
} else if (result instanceof Map<?, ?>) {
map.put(key, new JsonObject((Map<?, ?>) result, includeSuperClass));
} else if (isStandardProperty(result.getClass())) { // Primitives,
// String and
// Wrapper
map.put(key, result);
} else {
if (result.getClass().getPackage().getName().startsWith("java")
|| result.getClass().getClassLoader() == null) {
map.put(key, result.toString());
} else { // User defined Objects
map.put(key, new JsonObject(result, includeSuperClass));
}
}
}
}
} catch (Exception e) {