toObject
public static <T> T toObject(Class<T> clazz,
String source)
throws JSONException
Load a JSON string into an instantiated object. All the public fields of the object will
be set by the values in the JSON string associated with the field name.
Because of the naming convention in Java, the first letter of the field name will be capitalized
for another look-up in the JSON, if the original field name is not found.
- Parameters:
clazz
- Class of the object which the JSON string would be loaded into.source
- JSON string.
- Returns:
- An instantiated object of the given Class
- Throws:
JSONException