Repository: kestra-io/kestra
File: core/src/main/java/io/kestra/core/runners/FlowInputOutput.java (Java)

Code before:
                case SECRET -> {
                    if (secretKey.isEmpty()) {
                        throw new Exception("Unable to use a `SECRET` input/output as encryption is not configured");
                    }
                    yield EncryptionService.encrypt(secretKey.get(), current.toString());
                }
                case INT -> current instanceof Integer ? current : Integer.valueOf(current.toString());
                // Assuming that after the render we must have a double/int, so we can safely use its toString representation
                case FLOAT -> current instanceof Float ? current : Float.valueOf(current.toString());
                case BOOLEAN -> current instanceof Boolean ? current : Boolean.valueOf(current.toString());
                case BOOL -> current instanceof Boolean ? current : Boolean.valueOf(current.toString());
                case DATETIME -> current instanceof Instant ? current : Instant.parse(current.toString());
                case DATE -> current instanceof LocalDate ? current : LocalDate.parse(current.toString());
                case TIME -> current instanceof LocalTime ? current : LocalTime.parse(current.toString());
                case DURATION -> current instanceof Duration ? current : Duration.parse(current.toString());
                case FILE -> {
                    URI uri = URI.create(current.toString().replace(File.separator, "/"));

                    if (URIFetcher.supports(uri)) {
                        yield uri;
                    } else {
                        yield storageInterface.from(execution, id, current.toString().substring(current.toString().lastIndexOf("/") + 1), new File(current.toString()));
                    }
                }
                case JSON -> JacksonMapper.toObject(current.toString());
                case YAML -> {
                    String yaml;
                    if(current instanceof Collection<?> || current instanceof Map){
                        yaml = YAML_MAPPER.writeValueAsString(current);
                    }
                    else{
                        yaml = current.toString();
                    }

                    yield YAML_MAPPER.readValue(yaml, JacksonMapper.OBJECT_TYPE_REFERENCE);
                }
                case URI -> {
                    Matcher matcher = URI_PATTERN.matcher(current.toString());
                    if (matcher.matches()) {
                        yield current.toString();
                    } else {
                        throw new IllegalArgumentException("Expected `URI` but received `" + current + "`");
                    }
                }
                case ARRAY, MULTISELECT -> {
                    List<?> asList;
                    if (current instanceof List<?> list) {
                        asList = list;
                    } else {
                        asList = JacksonMapper.toList(((String) current));
                    }

Review comment (suggestion):
If I undetrstand it, it can only occurs when the value comes from input defaults as here the value will be deserialized as a Map (as a YAML is a Map).

So I think a more compact implementation may be a oneliner like:

```java
case YAML -> current instandof Map ? current : YYAML_MAPPER.readValue(current.toString(), JacksonMapper.OBJECT_TYPE_REFERENCE);
```

Code after:
                    yield EncryptionService.encrypt(secretKey.get(), current.toString());
                }
                case INT -> current instanceof Integer ? current : Integer.valueOf(current.toString());
                // Assuming that after the render we must have a double/int, so we can safely use its toString representation
                case FLOAT -> current instanceof Float ? current : Float.valueOf(current.toString());
                case BOOLEAN -> current instanceof Boolean ? current : Boolean.valueOf(current.toString());
                case BOOL -> current instanceof Boolean ? current : Boolean.valueOf(current.toString());
                case DATETIME -> current instanceof Instant ? current : Instant.parse(current.toString());
                case DATE -> current instanceof LocalDate ? current : LocalDate.parse(current.toString());
                case TIME -> current instanceof LocalTime ? current : LocalTime.parse(current.toString());
                case DURATION -> current instanceof Duration ? current : Duration.parse(current.toString());
                case FILE -> {
                    URI uri = URI.create(current.toString().replace(File.separator, "/"));

                    if (URIFetcher.supports(uri)) {
                        yield uri;
                    } else {
                        yield storageInterface.from(execution, id, current.toString().substring(current.toString().lastIndexOf("/") + 1), new File(current.toString()));
                    }
                }
                case JSON -> (current instanceof Map || current instanceof Collection<?>) ? current :  JacksonMapper.toObject(current.toString());
                case YAML -> (current instanceof Map || current instanceof Collection<?>) ? current : YAML_MAPPER.readValue(current.toString(), JacksonMapper.OBJECT_TYPE_REFERENCE);
                case URI -> {
                    Matcher matcher = URI_PATTERN.matcher(current.toString());
                    if (matcher.matches()) {
                        yield current.toString();
                    } else {
                        throw new IllegalArgumentException("Expected `URI` but received `" + current + "`");
                    }
                }
                case ARRAY, MULTISELECT -> {
                    List<?> asList;
                    if (current instanceof List<?> list) {
                        asList = list;
                    } else {
                        asList = JacksonMapper.toList(((String) current));
                    }

                    if (elementType != null) {
                        // recursively parse the elements only once
                        yield asList.stream()
                            .map(throwFunction(element -> {
                                try {
                                    return parseType(execution, elementType, id, null, element);
                                } catch (Throwable e) {
                                    throw new IllegalArgumentException("Unable to parse array element as `" + elementType + "` on `" + element + "`", e);
                                }
                            }))
                            .toList();
                    } else {
                        yield asList;