@Override public void write(V1Span value, WriteBuffer b) {
    b.writeAscii("{\"traceId\":\"");
    if (value.traceIdHigh() != 0L) b.writeLongHex(value.traceIdHigh());
    b.writeLongHex(value.traceId());
    b.writeByte('"');
    if (value.parentId() != 0L) {
      b.writeAscii(",\"parentId\":\"");
      b.writeLongHex(value.parentId());
      b.writeByte('"');
    }
    b.writeAscii(",\"id\":\"");
    b.writeLongHex(value.id());
    b.writeByte('"');
    b.writeAscii(",\"name\":\"");
    if (value.name() != null) b.writeUtf8(jsonEscape(value.name()));
    b.writeByte('"');

    if (value.timestamp() != 0L) {
      b.writeAscii(",\"timestamp\":");
      b.writeAscii(value.timestamp());
    }
    if (value.duration() != 0L) {
      b.writeAscii(",\"duration\":");
      b.writeAscii(value.duration());
    }

    int annotationCount = value.annotations().size();
    Endpoint lastEndpoint = null;
    byte[] lastEndpointBytes = null;
    if (annotationCount > 0) {
      b.writeAscii(",\"annotations\":[");
      for (int i = 0; i < annotationCount; ) {
        V1Annotation a = value.annotations().get(i++);
        Endpoint endpoint = a.endpoint();
        byte[] endpointBytes;
        if (endpoint == null) {
          endpointBytes = null;
        } else if (endpoint.equals(lastEndpoint)) {
          endpointBytes = lastEndpointBytes;
        } else {
          lastEndpoint = endpoint;
          endpointBytes = lastEndpointBytes = legacyEndpointBytes(endpoint);
        }
        writeAnnotation(a.timestamp(), a.value(), endpointBytes, b);
        if (i < annotationCount) b.writeByte(',');
      }
      b.writeByte(']');
    }
    int binaryAnnotationCount = value.binaryAnnotations().size();
    if (binaryAnnotationCount > 0) {
      b.writeAscii(",\"binaryAnnotations\":[");
      for (int i = 0; i < binaryAnnotationCount; ) {
        V1BinaryAnnotation a = value.binaryAnnotations().get(i++);
        Endpoint endpoint = a.endpoint();
        byte[] endpointBytes;
        if (endpoint == null) {
          endpointBytes = null;
        } else if (endpoint.equals(lastEndpoint)) {
          endpointBytes = lastEndpointBytes;
        } else {
          lastEndpoint = endpoint;
          endpointBytes = lastEndpointBytes = legacyEndpointBytes(endpoint);
        }
        if (a.stringValue() != null) {
          writeBinaryAnnotation(a.key(), a.stringValue(), endpointBytes, b);
        } else {
          b.writeAscii("{\"key\":\"");
          b.writeAscii(a.key());
          b.writeAscii("\",\"value\":true,\"endpoint\":");
          b.write(endpointBytes);
          b.writeByte('}');
        }
        if (i < binaryAnnotationCount) b.writeByte(',');
      }
      b.writeByte(']');
    }
    if (Boolean.TRUE.equals(value.debug())) {
      b.writeAscii(",\"debug\":true");
    }
    b.writeByte('}');
  }
This type is only used to backport the v1 read api as it returns v1 json.
zipkin/src/main/java/zipkin2/internal/V1SpanWriter.java