in src/main/java/com/microsoft/azure/functions/worker/binding/DataOperations.java [152:168]
private Optional<R> convertFromJson(String sourceValue, Type targetType) {
if (null == sourceValue) {
return null;
}
Object result = null;
try {
result = RpcJsonDataSource.gson.fromJson(sourceValue, targetType);
} catch (JsonSyntaxException ex) {
if (Collection.class.isAssignableFrom(TypeUtils.getRawType(targetType, null)) || targetType.getClass().isArray()) {
result = RpcJsonDataSource.convertToStringArrayOrList(sourceValue, targetType);
}
else {
throw ex;
}
}
return (Optional<R>) Optional.ofNullable(result);
}