protected static String jacksonObjectToString ( Object object ) { try { return mapper . writeValueAsString ( object ) ; } catch ( JsonProcessingException e ) { logger . error ( "Failed to serialize JSON data: " + e . toString ( ) ) ; return null ; } }
Serializes the given object in JSON and returns the resulting string . In case of errors null is returned . In particular this happens if the object is not based on a Jackson - annotated class . An error is logged in this case .