Browse Source

Polish

pull/45582/head
Phillip Webb 11 months ago
parent
commit
b2e65f665a
  1. 9
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JsonValueWriter.java

9
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JsonValueWriter.java

@ -115,10 +115,7 @@ class JsonValueWriter { @@ -115,10 +115,7 @@ class JsonValueWriter {
throw new UncheckedIOException(ex);
}
}
else if (value instanceof Path p) {
writeString(p.toString());
}
else if (value instanceof Iterable<?> iterable) {
else if (value instanceof Iterable<?> iterable && canWriteAsArray(iterable)) {
writeArray(iterable::forEach);
}
else if (ObjectUtils.isArray(value)) {
@ -135,6 +132,10 @@ class JsonValueWriter { @@ -135,6 +132,10 @@ class JsonValueWriter {
}
}
private <V> boolean canWriteAsArray(Iterable<?> iterable) {
return !(iterable instanceof Path);
}
/**
* Start a new {@link Series} (JSON object or array).
* @param series the series to start

Loading…
Cancel
Save