public < T > T deserialize ( String body , TypeRef returnType ) throws ApiException { JavaType javaType = mapper . constructType ( returnType . getType ( ) ) ; try { return mapper . readValue ( body , javaType ) ; } catch ( IOException e ) { if ( returnType . getType ( ) . equals ( String . class ) ) return ( T ) body ; else throw new ApiException ( 500 , e . getMessage ( ) , null , body ) ; } }
Deserialize the given JSON string to Java object .