private byte[] encodeTraces(List<List<Span>> traces) {
        if (CollectionUtils.isEmpty(traces)) {
            return new byte[] {
                '[',
                ']'
            };
        }
        List<byte[]> encodedTraces = new ArrayList<>(traces.size());
        int tracesSize = traces.size();
        int length = 0;
        for (List<Span> trace : traces) {
            byte[] traceByte = SpanBytesEncoder.JSON_V2.encodeList(trace);
            encodedTraces.add(traceByte);
            length += traceByte.length;
        }
        //bytes length = length + '[' + ']' + join ','
        byte[] allByteArray = new byte[length + 2 + traces.size() - 1];
        ByteBuffer buff = ByteBuffer.wrap(allByteArray);
        buff.put((byte) '[');
        for (int i = 0; i < tracesSize; i++) {
            buff.put(encodedTraces.get(i));
            if (i < tracesSize - 1)
                buff.put((byte) ',');
        }
        buff.put((byte) ']');
        return buff.array();
    }
Reference from zipkin2.server.internal.ZipkinQueryApiV2 for the API consistent.
oap-server/server-query-plugin/zipkin-query-plugin/src/main/java/org/apache/skywalking/oap/query/zipkin/handler/ZipkinQueryHandler.java