class JsonConverter extends AbstractConfigurationConverter {

    JsonValue readJsonObjectFromValue(final String key, final @Nullable Object value) throws ComponentConfigurationException {
        if (value instanceof JsonObject) {
            return (JsonObject) value;
        } else if (value instanceof String) {
            try (JsonReader reader = Json.createReader(new StringReader((String) value))) {
                return reader.readObject();
            } catch (JsonException e) {
                throw new ComponentConfigurationException("Failed to parse value for key " + key + " as JsonObject.", e);
            }
        }
        return JsonObject.NULL;
    }

}