Flask-restx uses ujson for serialization by default, falling back to normal json if unavailable.
As has been mentioned before ujson is quite flawed, with some people reporting rounding errors.
Additionally, ujson.dumps does not take the default argument, which allows one to pass any custom method as the serializer. Since my project uses some custom serialization, I have been forced to fork flask-restx and just remove the ujson import line...
You could add an option to choose which lib to use, or completely remove ujson from there. I think it is bad practice to have to maintain the code for two lbraries with different APIs.
An alternative could be to make ujson an optional dependency and not list it in the package dependencies, but keep the current imports as they are. As a result, anyone wanting to use ujson can install it and it will take over transparently.
Original issue: https://github.com/noirbizarre/flask-restplus/issues/589
I would gladly make the PR if you are happy with one of these solutions
Flask-restx uses
ujson
for serialization by default, falling back to normaljson
if unavailable. As has been mentioned beforeujson
is quite flawed, with some people reporting rounding errors.Additionally,
ujson.dumps
does not take thedefault
argument, which allows one to pass any custom method as the serializer. Since my project uses some custom serialization, I have been forced to fork flask-restx and just remove the ujson import line...You could add an option to choose which lib to use, or completely remove ujson from there. I think it is bad practice to have to maintain the code for two lbraries with different APIs. An alternative could be to make ujson an optional dependency and not list it in the package dependencies, but keep the current imports as they are. As a result, anyone wanting to use ujson can install it and it will take over transparently.
Original issue:
https://github.com/noirbizarre/flask-restplus/issues/589
I would gladly make the PR if you are happy with one of these solutions