class JsonConverter implements AttributeConverter {

    private final Class<? extends Object> clazz;

    private TypeReference<? extends Object> typeReference;

    /**
     * <p>Constructor for JsonConverter.</p>
     *
     * @param clazz a {@link Class} object
     */
    public JsonConverter(final Class<? extends Object> clazz) {
        this.clazz = clazz;
    }

    /**
     * <p>Constructor for JsonConverter.</p>
     *
     * @param clazz a {@link Class} object
     * @param typeReference a {@link TypeReference} object
     */
    public JsonConverter(final Class<? extends Object> clazz, final TypeReference<? extends Object> typeReference) {
        this(clazz);
        this.typeReference = typeReference;
    }

    /** {@inheritDoc} */
    @Override
    public Object convert(final Object attribute) {<FILL_FUNCTION_BODY>}
}

        if (attribute != null) {
            if (clazz.isAssignableFrom(attribute.getClass())) {
                return attribute;
            } else if (attribute instanceof String || attribute instanceof JsonNode) {
                final String s;
                if (attribute instanceof String) {
                    s = (String) attribute;
                } else {
                    s = JsonHelper.toJSONString(attribute);
                }

                try {
                    if (typeReference != null) {
                        return JsonHelper.getMapper().readValue(s, typeReference);
                    } else {
                        return JsonHelper.getMapper().readValue(s, clazz);
                    }
                } catch (final IOException e) {
                    LOGGER.error("Cannot read value", e);
                }
            }
        }
        return null;
    
<no_super_class>