For Python json.dumps embedded object issues, you gotta teach it how to serialize your stuff.
Either:
- Add a `to_json()` method to your objects that returns a dict.
- Or use a lambda in `default=` to handle custom types.
Like:
```python
json.dumps(your_data, default=lambda x: x.__dict__ if hasattr(x, '__dict__') else str(x))
```
Not perfect, but cleaner than `default=str`.
Either:
- Add a `to_json()` method to your objects that returns a dict.
- Or use a lambda in `default=` to handle custom types.
Like:
```python
json.dumps(your_data, default=lambda x: x.__dict__ if hasattr(x, '__dict__') else str(x))
```
Not perfect, but cleaner than `default=str`.
