I use the json.dumps() to pack datas as follow, using complex_signal.tolist() or str(complex_signal) is same result too;
import json
#send to kafka
def Send(complex_signal, frequency, time):
signal = { #
"time": time,
"frequency": frequency,
"complex_signal": complex_signal# this is a ndarray type
}
msg = json.dumps(signal)
producer.produce('topic_test', key=None, value=msg)
console out :raise TypeError(f'Object of type {o.class.name} ' TypeError: Object of type module is not JSON serializable
JSON,I use rtl-sdr to get signal and send it to kafka .