I want to save numpy arrays to a jsonlines file. Using the code below:
import jsonlines
with jsonlines.open('output.jsonl', mode='w') as writer:
writer.write({'a':np.array([2,3])})
with jsonlines.open('output.jsonl', mode='a') as writer:
writer.write({'b':np.array([3,5])})
But I get this error:
TypeError: Object of type 'ndarray' is not JSON serializable
I wonder is there any way to save numpy arrays in jsonl format.