我試圖在 python 中將 thrift 對象轉換為 json。如果我嘗試使用json.dumps(thriftObj),它會失敗并顯示以下內容:TypeError: MyThriftObj(...) is not JSON serializable我嘗試使用默認功能修復它:json.dumps(thriftObj, default=lambda x: x.__dict__)這在某些情況下有效,但在其他情況下我收到錯誤: AttributeError: 'DictProxy' object has no attribute '__dict__'如何將有效的節儉對象轉換為 json?
如何在 python 中將節儉對象轉換為 Json?
ibeautiful
2022-06-02 10:11:27