code: public static String toJson(CouchbaseEvent source, boolean pretty) {
          try {
              if (pretty) {
                  return DefaultObjectMapper.prettyWriter().writeValueAsString(source.toMap());
              } else {
                  return DefaultObjectMapper.writeValueAsString(source.toMap());
              }
          } catch (JsonProcessingException e) {
              throw new CouchbaseException("Could not convert CouchbaseEvent " + source.toString() + " to JSON: ", e);
          }
      }
docs: Takes a {@link CouchbaseEvent} and generates a JSON string.
  
  @param source the source event.
  @param pretty if pretty print should be used.
  @return the generated json string.