@Override public int sizeInBytes(V1Span value) {
    int sizeInBytes = 29; // {"traceId":"xxxxxxxxxxxxxxxx"
    if (value.traceIdHigh() != 0L) sizeInBytes += 16;
    if (value.parentId() != 0L) {
      sizeInBytes += 30; // ,"parentId":"0123456789abcdef"
    }
    sizeInBytes += 24; // ,"id":"0123456789abcdef"
    sizeInBytes += 10; // ,"name":""
    if (value.name() != null) {
      sizeInBytes += jsonEscapedSizeInBytes(value.name());
    }
    if (value.timestamp() != 0L) {
      sizeInBytes += 13; // ,"timestamp":
      sizeInBytes += asciiSizeInBytes(value.timestamp());
    }
    if (value.duration() != 0L) {
      sizeInBytes += 12; // ,"duration":
      sizeInBytes += asciiSizeInBytes(value.duration());
    }

    int annotationCount = value.annotations().size();
    Endpoint lastEndpoint = null;
    int lastEndpointSize = 0;
    if (annotationCount > 0) {
      sizeInBytes += 17; // ,"annotations":[]
      if (annotationCount > 1) sizeInBytes += annotationCount - 1; // comma to join elements
      for (int i = 0; i < annotationCount; i++) {
        V1Annotation a = value.annotations().get(i);
        Endpoint endpoint = a.endpoint();
        int endpointSize;
        if (endpoint == null) {
          endpointSize = 0;
        } else if (endpoint.equals(lastEndpoint)) {
          endpointSize = lastEndpointSize;
        } else {
          lastEndpoint = endpoint;
          endpointSize = lastEndpointSize = endpointSizeInBytes(endpoint, true);
        }
        sizeInBytes += V2SpanWriter.annotationSizeInBytes(a.timestamp(), a.value(), endpointSize);
      }
    }

    int binaryAnnotationCount = value.binaryAnnotations().size();
    if (binaryAnnotationCount > 0) {
      sizeInBytes += 23; // ,"binaryAnnotations":[]
      if (binaryAnnotationCount > 1) sizeInBytes += binaryAnnotationCount - 1; // commas
      for (int i = 0; i < binaryAnnotationCount; ) {
        V1BinaryAnnotation a = value.binaryAnnotations().get(i++);
        Endpoint endpoint = a.endpoint();
        int endpointSize;
        if (endpoint == null) {
          endpointSize = 0;
        } else if (endpoint.equals(lastEndpoint)) {
          endpointSize = lastEndpointSize;
        } else {
          lastEndpoint = endpoint;
          endpointSize = lastEndpointSize = endpointSizeInBytes(endpoint, true);
        }
        if (a.stringValue() != null) {
          sizeInBytes += binaryAnnotationSizeInBytes(a.key(), a.stringValue(), endpointSize);
        } else {
          sizeInBytes += 37; // {"key":"NN","value":true,"endpoint":}
          sizeInBytes += endpointSize;
        }
      }
    }

    if (Boolean.TRUE.equals(value.debug())) sizeInBytes += 13; // ,"debug":true
    return ++sizeInBytes; // }
  }
This type is only used to backport the v1 read api as it returns v1 json.
zipkin/src/main/java/zipkin2/internal/V1SpanWriter.java