Skip to content

Commit

Permalink
Disable escaping of some characters in json format (bazelbuild#3)
Browse files Browse the repository at this point in the history
It escapes some characters by default like '<' and '>'
This disables that
  • Loading branch information
burakcoskun authored and Alessandro Patti committed Oct 21, 2019
1 parent f9486c4 commit 71894a3
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.sun.org.apache.xpath.internal.operations.Bool;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
Expand Down Expand Up @@ -63,7 +62,7 @@ public OutputFormatterCallback<Target> createPostFactoStreamCallback(
return new OutputFormatterCallback<Target>() {

private JsonObject result = new JsonObject();
private Gson gson = new GsonBuilder().setPrettyPrinting().create();
private Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();

@Override
public void processOutput(Iterable<Target> partialResult)
Expand Down Expand Up @@ -104,7 +103,7 @@ private static JsonObject createTargetJsonObject(Target target) {
}

private static JsonElement getJsonFromValue(Object val) {
Gson gson = new Gson();
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
if (val instanceof List) {
Iterator<Object> it = ((List) val).iterator();
JsonArray result = new JsonArray();
Expand Down

0 comments on commit 71894a3

Please sign in to comment.