public static <T> String toJSON(T obj) {
        try {
            String toJsonResult = mapper.writeValueAsString(obj);
            String filterJsonResult = JSONUtils
                    .filterOutIllegalCharacter(toJsonResult);
            if (logger.isDebugEnabled()) {
                if (!StringUtils.equals(filterJsonResult, toJsonResult)) {
                    logger.debug("to json filter make diff, \nraw:"
                            + toJsonResult + "\nfiltered:" + filterJsonResult);
                }
            }
            return filterJsonResult;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }