overriding JSONEncoder #162

Closed
wants to merge 1 commit into
from

2 participants

@smalls

Hey, I don't know if this is the right flask-ish way to do this, but it would great to have a way to set the JSONEncoder to allow for non-dict object types. This seemed like the easiest way, but I didn't see a good way to fit this into the existing config.

-matt

@mitsuhiko
The Pallets Projects member

This solution is not thread safe unfortunately. If you really need a custom json encoder I recommend writing your own jsonify function instead. It does not take many lines of code and its easier to customize then. I was briefly thinking about adding a setting to the application object that would control that, but the downside is that it then would only affect jsonify and not the json.loads etc. functions.

I raelly think this should be solved individually for the applications. At least unless someone has a clever and nice solution for that :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment