public String toString(boolean compact) {
        Slime slime = new Slime();
        serialize(slime.setObject());
        JsonFormat format = new JsonFormat(compact);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            format.encode(baos, slime);
        } catch (IOException e) {
            throw new IllegalArgumentException("Unable to encode trace as JSON", e);
        }
        return Utf8.toString(baos.toByteArray());
    }
A trace utility that can serialize/deserialize to/from {@link Slime}

@author Ulf Lilleengen
config/src/main/java/com/yahoo/vespa/config/protocol/Trace.java