我一直在尝试将dict转换为json,因为dict类型是不可调用的。但它给出了以下error。如何将int64转换为字符串?TypeError: Object of type 'int64' is not JSON serializabled = {'India': {'A': 1, 'C': 2}, 'Malaysia'
在后台django中,我会将数据作为json返回给前端,但是在前端有很多"null“值,一种解决方案是在创建值时修改代码,将值None转换为空字符串"”,但由于有很多地方,我想编写一个自定义的编码函数,在将obj转储为string时将None转换为"“。我使用了以下类,但它不起作用:
class PythonObjectEncoder(json.JSO