Skip to content

Instantly share code, notes, and snippets.

View hugithordarson's full-sized avatar

Hugi Thordarson hugithordarson

View GitHub Profile
/**
* Instantiates a java object of the given class and applies the values from the given JSONObject.
*
* @param <E> The type to create
* @param json The JSONObject to convert
* @param objectClass Class of the type to create
* @return An instance of the specified class
*/
public static <E> E objectFromJSON( JSONObject json, Class<E> objectClass ) {
try {