class JSONConverter {

    public <T> T fromJSON(Class<T> clazz, String jSON) throws JSONConverterException {
        if (clazz == null) {
            throw new IllegalStateException("clazz may not be null!");
        }
        /* Fall back for null values to empty string - avoid NPE */
        String string = jSON;
        if (jSON == null) {
            string = "";
        }
        try {
            byte[] bytes = string.getBytes();
            return mapper.readValue(bytes, clazz);
        } catch (IOException e) {

            LOG.debug("JSON conversion failed, origin JSON:\n{}", jSON);
            /*
             * we truncate json - because when JSON to big it could flood logs - debugging
             * above is only enabled sometimes, but exceptions do always accurre inside logs
             */
            String truncatedJSON = SimpleStringUtils.truncateWhenTooLong(jSON, 300);
            throw new JSONConverterException("Was not able to convert JSON string to " + clazz + " object\nContent was:\n" + truncatedJSON, e);
        }
    }

    public  JSONConverter();

}