public static String toJson(Inspector inspector, boolean compact) {
        var outputStream = new ByteArrayOutputStream();
        var jsonFormat = new JsonFormat(compact ? 0 : 2);
        uncheck(() -> jsonFormat.encode(outputStream, inspector));
        return outputStream.toString(StandardCharsets.UTF_8);
    }
Extra utilities/operations on slime trees.

@author Ulf Lilleengen
vespajlib/src/main/java/com/yahoo/slime/SlimeUtils.java