private static < T > T createObjectFromResponse ( Class < T > clazz , final String response ) throws InstagramException { Gson gson = new Gson ( ) ; T object ; try { object = gson . fromJson ( response , clazz ) ; } catch ( Exception e ) { throw new InstagramException ( "Error parsing json to object type " + clazz . getName ( ) , e ) ; } return object ; }
Creates an object from the JSON response and the class which the object would be mapped to .