code: public void writeTo(Appendable appendable) throws IOException {
          try (JsonOutput json = new Json().newOutput(appendable)) {
              json.beginObject();
  
              Map<String, Object> first = getOss();
              if (first == null) {
                  //noinspection unchecked
                  first = (Map<String, Object>) stream().findFirst()
                          .orElse(new ImmutableCapabilities())
                          .asMap();
              }
  
              // Write the first capability we get as the desired capability.
              json.name(DESIRED_CAPABILITIES);
              json.write(first);
  
              if (!forceMobileJSONWP) {
                  // And write the first capability for gecko13
                  json.name(CAPABILITIES);
                  json.beginObject();
  
                  // Then write everything into the w3c payload. Because of the way we do this, it's easiest
                  // to just populate the "firstMatch" section. The spec says it's fine to omit the
                  // "alwaysMatch" field, so we do this.
                  json.name(FIRST_MATCH);
                  json.beginArray();
                  getW3C().forEach(json::write);
                  json.endArray();
  
                  json.endObject();  // Close "capabilities" object
              }
  
              writeMetaData(json);
  
              json.endObject();
          }
      }
docs: Writes json capabilities to some appendable object.
  
  @param appendable to write a json