Closed academyofzhuang closed 4 years ago
json.dumps can't serialize user defined instance variables. If you allow us to pass in configuration to json.dumps, we can solve the problem.
def my_instance_json_encoder(x): lambda x: x.__dict__ s = json.dumps( users, default=my_instance_json_encoder )
Better yet:
config = { "default": lambda x: x.__dict__, "indent": " ", } json.dumps(users, config)
json.dumps can't serialize user defined instance variables. If you allow us to pass in configuration to json.dumps, we can solve the problem.
Better yet: