diff --git a/src/main/java/com/metaweb/gridworks/commands/freebase/PreviewProtographCommand.java b/src/main/java/com/metaweb/gridworks/commands/freebase/PreviewProtographCommand.java index 737c573ae..a203aadcb 100644 --- a/src/main/java/com/metaweb/gridworks/commands/freebase/PreviewProtographCommand.java +++ b/src/main/java/com/metaweb/gridworks/commands/freebase/PreviewProtographCommand.java @@ -58,7 +58,7 @@ public class PreviewProtographCommand extends Command { nodeFactory.flush(); sb.append(", \"mqllike\" : "); - sb.append(sb.toString()); + sb.append(stringWriter.toString()); } sb.append(" }"); diff --git a/src/main/java/com/metaweb/gridworks/protograph/transpose/MqlwriteLikeTransposedNodeFactory.java b/src/main/java/com/metaweb/gridworks/protograph/transpose/MqlwriteLikeTransposedNodeFactory.java index c9de3b7eb..f69aafb05 100644 --- a/src/main/java/com/metaweb/gridworks/protograph/transpose/MqlwriteLikeTransposedNodeFactory.java +++ b/src/main/java/com/metaweb/gridworks/protograph/transpose/MqlwriteLikeTransposedNodeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import org.json.JSONWriter; import com.metaweb.gridworks.model.Cell; import com.metaweb.gridworks.model.Recon; @@ -43,7 +44,18 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory @Override public void flush() throws IOException { - writer.write(getJSON().toString()); + try { + JSONWriter jsonWriter = new JSONWriter(writer); + + jsonWriter.array(); + for (JSONObject obj : rootObjects) { + jsonWriter.value(obj); + } + jsonWriter.endArray(); + + } catch (JSONException e) { + e.printStackTrace(); + } writer.flush(); }