How to display Python objects with nested data structure nicely?

Hi,
I run Jupyter notebooks inside VS Code. I need some help on displaying objects with nested data structure so that I can inspect their contents. The following is an example. Thanks.

In case I want better readability I take this route:

import json

json.loads(ai_msg.model_dump_json())
3 Likes

That works very well.Thank you!

1 Like