File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -115,10 +115,7 @@ else if (value instanceof WritableJson writableJson) {
115
115
throw new UncheckedIOException (ex );
116
116
}
117
117
}
118
- else if (value instanceof Path p ) {
119
- writeString (p .toString ());
120
- }
121
- else if (value instanceof Iterable <?> iterable ) {
118
+ else if (value instanceof Iterable <?> iterable && canWriteAsArray (iterable )) {
122
119
writeArray (iterable ::forEach );
123
120
}
124
121
else if (ObjectUtils .isArray (value )) {
@@ -135,6 +132,10 @@ else if (value instanceof Number || value instanceof Boolean) {
135
132
}
136
133
}
137
134
135
+ private <V > boolean canWriteAsArray (Iterable <?> iterable ) {
136
+ return !(iterable instanceof Path );
137
+ }
138
+
138
139
/**
139
140
* Start a new {@link Series} (JSON object or array).
140
141
* @param series the series to start
You can’t perform that action at this time.
0 commit comments