I have this sample of code :
Code: Select all
result = json.dumps(np.array(range(100),dtype=np.float)).encode('ascii')
print( result)
array = json.loads(str(result, 'ascii'))
print( array)
b'array([0.0, 1.0, 2.0, ..., 597.0, 598.0, 599.0], dtype=float32)'
Traceback (most recent call last):
File "<stdin>", line 20, in <module>
ValueError: syntax error in JSON
Any idea about how I could json to pass numpy array through a serial connection like this git : https://github.com/dhylands/json-ipc