我有一个由以下类定义的简单对象(message
):
class SimpleMessage:
dest_address = str()
message_type = int()
payload = str()
def __init__(self, dest_address, message_type, payload):
self.dest_address = dest_address
self.message_type = message_type
self.payload = payload
如何轻松将其转换为JSON?获得JSON之后,如何将其转回Python对象?示例代码将不胜感激,我找不到适合我的情况的任何