From ed32fca1d4a7cddc761f7705bd8d6cab1e01edbd Mon Sep 17 00:00:00 2001 From: Vadim Peretokin Date: Sun, 2 Jun 2019 14:08:58 +0200 Subject: [PATCH] Also output JSON if requested for narrative, snapshot generation & transformations --- .../src/main/java/org/hl7/fhir/r5/validation/Validator.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java index dccb82779..c071a9558 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java @@ -484,6 +484,8 @@ public class Validator { private static void handleOutputToStream(Resource r, String output, OutputStream s) throws IOException { if (output.endsWith(".html") || output.endsWith(".htm") && r instanceof DomainResource) new XhtmlComposer(XhtmlComposer.HTML, true).compose(s, ((DomainResource) r).getText().getDiv()); + else if (output.endsWith(".json")) + new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(s, r); else new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(s, r); s.close();