Skip to content

Commit 129dc36

Browse files
committed
Reset JsonEncoder to last working version
1 parent ddf98cd commit 129dc36

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/culturegraph/mf/stream/converter/JsonEncoder.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public void endEntity() {
8989
@Override
9090
public void literal(final String name, final String value) {
9191
try {
92-
if (jsonGenerator.getOutputContext().inObject()) {
92+
final JsonStreamContext ctx = jsonGenerator.getOutputContext();
93+
if (ctx.inObject()) {
9394
jsonGenerator.writeFieldName(name);
9495
}
9596
if (value == null) {
@@ -109,12 +110,12 @@ private void startGroup(final String name) {
109110
try {
110111
final JsonStreamContext ctx = jsonGenerator.getOutputContext();
111112
if (name.endsWith(ARRAY_MARKER)) {
112-
if (!ctx.inRoot()) {
113+
if (ctx.inObject()) {
113114
jsonGenerator.writeFieldName(name.substring(0, name.length() - ARRAY_MARKER.length()));
114115
}
115116
jsonGenerator.writeStartArray();
116117
} else {
117-
if (!ctx.inRoot()) {
118+
if (ctx.inObject()) {
118119
jsonGenerator.writeFieldName(name);
119120
}
120121
jsonGenerator.writeStartObject();

0 commit comments

Comments
 (0)