class Xs2aHttpLogSanitizer {

    public String sanitizeResponseBody(Object responseBody, String contentType) {
        if (contentType.startsWith(APPLICATION_JSON)) {
            try {
                String json;
                if (responseBody instanceof String) {
                    json = (String) responseBody;
                } else {
                    json = objectMapper.writeValueAsString(responseBody);
                }
                return sanitizeStringifiedJsonBody(json);
            } catch (Exception e) {
                logger.error("Can't parse response as json. It will be replaced with {}", REPLACEMENT);
            }

        }
        return REPLACEMENT;
    }

    public  Xs2aHttpLogSanitizer();

}