code: public String toJson()
        throws IOException {
      StringWriter writer = new StringWriter();
      try (JsonGenerator generator = jsonFactory.createJsonGenerator(writer)
          .setCodec(objectMapper)) {
        toJsonUtf8(generator);
      }
  
      return writer.toString();
    }
docs: Serialize as a String