Skip to content

Commit 7d99973

Browse files
StandardJsonPrettyPrinter - empty objects as {} (without space)
1 parent e7d0bb9 commit 7d99973

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

typescript-generator-core/src/main/java/cz/habarta/typescript/generator/util/StandardJsonPrettyPrinter.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ public void writeObjectFieldValueSeparator(JsonGenerator jg) throws IOException
3838
jg.writeRaw(": ");
3939
}
4040

41+
@Override
42+
public void writeEndObject(JsonGenerator g, int nrOfEntries) throws IOException {
43+
if (!_objectIndenter.isInline()) {
44+
--_nesting;
45+
}
46+
if (nrOfEntries > 0) {
47+
_objectIndenter.writeIndentation(g, _nesting);
48+
}
49+
g.writeRaw('}');
50+
}
51+
4152
@Override
4253
public void writeEndArray(JsonGenerator g, int nrOfValues) throws IOException {
4354
if (!_arrayIndenter.isInline()) {

0 commit comments

Comments
 (0)