docs: static List<String> convertToJson(String appName, Collection<SpanData> spanDataList) {
      List<String> spanJson = new ArrayList<String>();
      if (spanDataList == null) {
        return spanJson;
      }
      StringBuilder sb = new StringBuilder();
      for (final SpanData span : spanDataList) {
        final SpanContext spanContext = span.getContext();
        final SpanId parentSpanId = span.getParentSpanId();
        final Timestamp startTimestamp = span.getStartTimestamp();
        final Timestamp endTimestamp = span.getEndTimestamp();
        final Status status = span.getStatus();
        if (endTimestamp == null) {
          continue;
        }
        sb.append('{');
        sb.append("\"appName\":\"").append(appName).append("\",");
        sb.append("\"spanId\":\"").append(encodeSpanId(spanContext.getSpanId())).append("\",");
        sb.append("\"traceId\":\"").append(encodeTraceId(spanContext.getTraceId())).append("\",");
        if (parentSpanId != null) {
          sb.append("\"parentId\":\"").append(encodeSpanId(parentSpanId)).append("\",");
        }
        sb.append("\"timestamp\":").append(toMillis(startTimestamp)).append(',');
        sb.append("\"duration\":").append(toMillis(startTimestamp, endTimestamp)).append(',');
        sb.append("\"name\":\"").append(toSpanName(span)).append("\",");
        sb.append("\"kind\":\"").append(toSpanKind(span)).append("\",");
        sb.append("\"dateStarted\":\"").append(formatDate(startTimestamp)).append("\",");
        sb.append("\"dateEnded\":\"").append(formatDate(endTimestamp)).append('"');
        if (status == null) {
          sb.append(",\"status\":").append("\"ok\"");
        } else if (!status.isOk()) {
          sb.append(",\"error\":").append("true");
        }
        Map<String, AttributeValue> attributeMap = span.getAttributes().getAttributeMap();
        if (attributeMap.size() > 0) {
          StringBuilder builder = new StringBuilder();
          builder.append('{');
          for (Entry<String, AttributeValue> entry : attributeMap.entrySet()) {
            if (builder.length() > 1) {
              builder.append(',');
            }
            builder
                .append("\"")
                .append(entry.getKey())
                .append("\":\"")
                .append(attributeValueToString(entry.getValue()))
                .append("\"");
          }
          builder.append('}');
          sb.append(",\"data\":").append(builder);
        }
        sb.append('}');
        spanJson.add(sb.toString());
      }
      return spanJson;
    }