This commit is contained in:
Phillip Webb 2025-04-22 19:51:06 -07:00
parent 0a9f6a712c
commit b2e65f665a
1 changed files with 5 additions and 4 deletions

View File

@ -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 {
}
}
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