[b]"How to properly use python json_dump_obj for custom object serialization?"[/b] or [b]"Why is python json_dump_

16 Replies, 911 Views

Hey! Been there. python json_dump_obj won’t work out of the box with custom classes. You need to make your class JSON-serializable.

Easiest way? Use the `jsonpickle` library. Just `pip install jsonpickle` and do:
```python
import jsonpickle
json_str = jsonpickle.encode(your_obj)
```

Boom, done. No magic methods needed.

Messages In This Thread



Users browsing this thread: 1 Guest(s)