Python json问题整理
TypeError: Object of type 'int64' is not JSON serializable
def convert(o):
if isinstance(o, numpy.int64): return int(o)
raise TypeError
json.dumps({'value': numpy.int64(42)}, default=convert)
参考
https://stackoverflow.com/questions/11942364/typeerror-integer-is-not-json-serializable-when-serializing-json-in-python
浙公网安备 33010602011771号