The error’s annoying, but it’s not json.dumps’ fault—JSON itself doesn’t support custom types.
If you’re lazy (like me), try `json.dumps(your_obj, default=vars)`. Works if your object’s attributes are simple.
For more control, yeah, you’ll need a custom encoder. Or just use `pickle` if it’s for internal stuff (but don’t use pickle for APIs, obvs).
If you’re lazy (like me), try `json.dumps(your_obj, default=vars)`. Works if your object’s attributes are simple.
For more control, yeah, you’ll need a custom encoder. Or just use `pickle` if it’s for internal stuff (but don’t use pickle for APIs, obvs).
