Closed hmMed22 closed 4 years ago
The problem was solved by adding this code
class NumpyEncoder(json.JSONEncoder): """ Special json encoder for numpy types """ def default(self, obj): if isinstance(obj, np.integer): return int(obj) elif isinstance(obj, np.floating): return float(obj) elif isinstance(obj, np.ndarray): return obj.tolist() return json.JSONEncoder.default(self, obj)
and
json.dump(Logval, f,cls=NumpyEncoder)
Hello, Thank you for your great packages. I run hpopt.py but at the end of the process, nothing has been written in JSON output file due to bellow error Any help would be greatly appreciated
TypeError: Object of type int32 is not JSON serializable`