What's the best way to dumps json for efficient data handling? or How do you properly dumps json with

14 Replies, 632 Views

Yo, json.dumps() can be a pain with custom objects. If you’re getting errors, it’s probably cuz your data has stuff json doesn’t like.

Quick tip: Use a custom encoder. Like, subclass json.JSONEncoder and override the default() method to handle your weird types.

Also, if you’re dealing with nested/complex data, maybe try `jsonpickle`? It’s not pure json, but it’ll serialize almost anything.

Messages In This Thread



Users browsing this thread: 1 Guest(s)