📅  最后修改于: 2022-03-11 15:03:19.484000             🧑  作者: Mango
# It seems like there may be a issue to dump numpy.int64 into json string in Python 3.
# the generic solution:
def convert(o):
if isinstance(o, np.generic): return o.item()
raise TypeError
json.dumps({'value': numpy.int64(42)}, default=convert)