public String serialize ( Object obj ) throws ApiException { try { if ( obj != null ) return mapper . writeValueAsString ( obj ) ; else return null ; } catch ( Exception e ) { throw new ApiException ( 400 , e . getMessage ( ) ) ; } }
Serialize the given Java object into JSON string .