今天,在將字典轉爲json串時,遇到錯誤Object of type ‘int64’ is not JSON serializable
print(aiop)
結果爲[8, 8]
後來發現居然是list中數字的類型不同
print(type(aiop[0]))
print(type(aiop[1]))
結果爲
<class 'numpy.int64'>
<class 'numpy.int64'>
所以會報錯。
坑死爹了
今天,在將字典轉爲json串時,遇到錯誤Object of type ‘int64’ is not JSON serializable
print(aiop)
結果爲[8, 8]
後來發現居然是list中數字的類型不同
print(type(aiop[0]))
print(type(aiop[1]))
結果爲
<class 'numpy.int64'>
<class 'numpy.int64'>
所以會報錯。
坑死爹了