How to create a buffer to send json data to the server quantitatively

Hello,everyone!I want to create a buffer to store ecg<2384>,emg<2384> data, each time only storing 2 channels and 384 data points, and once enough data points are obtained, send the data in json format to the server. The size of the buffer is fixed. After each transmission, all previous data is not deleted. The data is only moved forward one row to add new data points. Is there any way to do this? :weary: