diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/jep/QuiltPackage.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/jep/QuiltPackage.groovy index 4db85cb5..1c19f6c8 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/jep/QuiltPackage.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/jep/QuiltPackage.groovy @@ -39,12 +39,15 @@ import com.quiltdata.quiltcore.key.LocalPhysicalKey import com.quiltdata.quiltcore.key.S3PhysicalKey import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.ObjectWriter import com.fasterxml.jackson.databind.node.ObjectNode @Slf4j @CompileStatic class QuiltPackage { + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() + private static final ObjectWriter OBJECT_WRITER = OBJECT_MAPPER.writerWithDefaultPrettyPrinter() private static final Map PKGS = [:] private static final String INSTALL_PREFIX = 'QuiltPackage' static final Path INSTALL_ROOT = Files.createTempDirectory(INSTALL_PREFIX) @@ -83,11 +86,11 @@ class QuiltPackage { static String toJson(Map dict) { List entries = dict.collect { key, value -> - String prefix = JsonOutput.toJson(key) + String prefix = OBJECT_WRITER.writeValueAsString(key) log.debug("toJson.${key}: ${value}") String suffix = "toJson.error[${value}]" try { - suffix = JsonOutput.toJson(value) + suffix = OBJECT_WRITER.writeValueAsString(value) } catch (Exception e) { log.error(suffix, e)