New submission from miscjunk:
When json.dumps() is called on a numpy.bool_ object, it crashes.
To recreate:
import numpy as np
import json
a = np.array([1,2,3,4,5,6])
a = a < 5
json.dumps(a) #crash
json.dumps(a[0]) #crash
json.dumps(a.tolist()) #this works!
Example of error output
Traceb
miscjunk added the comment:
numpy.ndarray is also not serializable by json.dumps()
import numpy as np
import json
a = np.array([1,2,3,4])
json.dumps(a) #crash
json.dumps(a[0]) #this works!
--
title: json.dumps() claims numpy.bool_ is not serializable -> json.dumps()
cla
miscjunk added the comment:
Thanks for the explanation. I suppose this should be posted to the numpy
tracker then? Would it be possible for numpy to 'just work' with the json
module? Or will the final resolution be to use a handler (the default=
parameter in json.loads)