Skip to content

Commit

Permalink
inline variable
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysdh540 committed Aug 6, 2024
1 parent e134a6c commit 2fde59d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/dev/nolij/zson/Zson.java
Original file line number Diff line number Diff line change
Expand Up @@ -1089,14 +1089,15 @@ private String value(Object value) {
return String.valueOf(value);
} else if (value instanceof Iterable<?> iterableValue) {
StringBuilder output = new StringBuilder("[");
output.append(expandArrays ? "\n" : " ");
String indent = expandArrays ? this.indent : "";
output.append(indent);

boolean first = true;

for (Object obj : iterableValue) {
if (!first) {
output.append(",")
.append(expandArrays ? "\n" : " ");
.append(indent);
} else {
first = false;
}
Expand All @@ -1108,7 +1109,7 @@ private String value(Object value) {
output.append(value(obj).replace("\n", "\n" + indent + indent));
}

output.append(expandArrays ? "\n" : " ");
output.append(indent);

if (expandArrays)
output.append(indent);
Expand Down

0 comments on commit 2fde59d

Please sign in to comment.