[b]"How do you properly python cast json as object? Best practices?"[/b] or [b]"What's the correct way to python c

18 Replies, 801 Views

"Struggling to python cast json as object – any tips?"

Hey folks!

So I’ve been messing around with some APIs and keep running into this issue—trying to python cast json as object in Python. I know `json.loads()` gets me a dict, but sometimes I wanna work with it like an actual object (dot notation, ya know?).

I’ve seen stuff like `namedtuple` or `SimpleNamespace`, but not sure what’s the cleanest way.

Any of you got a favorite method? Or is there a slick lib for this?

(Also, pls no "just use dicts" replies—I’m stubborn and wanna do it this way lol.)

Thanks in advance! 🚀

Messages In This Thread
[b]"How do you properly python cast json as object? Best practices?"[/b] or [b]"What's the correct way to python c - by - 24-10-2024, 06:28 AM



Users browsing this thread: 1 Guest(s)