Skip to content

Commit afe3ccf

Browse files
committed
Serialise nulls when pretty-printing
1 parent ab96aff commit afe3ccf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jsonvalidator-common/src/main/java/eu/europa/ec/itb/json/validation/ValidationSpecs.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ public boolean isProduceAggregateReport() {
144144
private File prettyPrint(File input) {
145145
try (FileReader in = new FileReader(input)) {
146146
JsonElement json = com.google.gson.JsonParser.parseReader(in);
147-
Gson gson = new GsonBuilder().setPrettyPrinting().create();
147+
Gson gson = new GsonBuilder()
148+
.setPrettyPrinting()
149+
.serializeNulls()
150+
.create();
148151
String jsonOutput = gson.toJson(json);
149152
File output = new File(input.getParent(), input.getName() + ".pretty");
150153
FileUtils.writeStringToFile(output, jsonOutput, StandardCharsets.UTF_8);

0 commit comments

Comments
 (0)