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());
  }
}

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 .
