docs: private JsonObject toJsonObject() {
          JsonObjectBuilder factory = Json.createObjectBuilder();
          if (profile != null) {
              factory.add("profile", profile);
          }
          if (!hosts.isEmpty()) {
              JsonArrayBuilder ab = Json.createArrayBuilder();
              for (String host : hosts) {
                  ab.add(host);
              }
              factory.add("hosts", ab.build());
          }
          if (label != null) {
              factory.add("label", label);
          }
  
          if (caName != null) {
              factory.add(HFCAClient.FABRIC_CA_REQPROP, caName);
          }
          factory.add("certificate_request", csr);
  
          if (attrreqs != null) {
              JsonArrayBuilder ab = Json.createArrayBuilder();
              for (AttrReq attrReq : attrreqs.values()) {
                  JsonObjectBuilder i = Json.createObjectBuilder();
                  i.add("name", attrReq.name);
                  if (attrReq.optional != null) {
                      i.add("optional", attrReq.optional);
                  }
                  ab.add(i);
  
              }
              factory.add("attr_reqs", ab.build());
          }
  
          return factory.build();
      }