Object of type 'ndarray' is not JSON serializable
import numpy as np
import json
arr=np.asarray([345,45])
result={'name':'test','num':ar}
json.dump(result)
解决方法:
result={'name':'text','num':ar.tolist()}
json不认numpy的array
Object of type 'ndarray' is not JSON serializable
import numpy as np
import json
arr=np.asarray([345,45])
result={'name':'test','num':ar}
json.dump(result)
解决方法:
result={'name':'text','num':ar.tolist()}
json不认numpy的array