You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Flask2.3.X, flask.json module deprecated JSONEncoder class, override_json_encoder is not working now.
It will raise ImportError: cannot import name 'JSONEncoder' from 'flask.json'
Reacted by Gleb Ignatev, Andrei Seliverstov, xrkk, Mike, Julian, Vladimir Markov, Winedays, Anatoly, Juan A. S., rimvydas-zilinskas and 10 more
json_encoder and json_decoder attributes on app and blueprint, and the corresponding json.JSONEncoder and JSONDecoder classes, are removed from Flask version 2.3.0.
So, it shows JSONEncoder = json.JSONEncoder
AttributeError: module 'flask.json' has no attribute 'JSONEncoder'
Activity
jrypel commentedon May 7, 2023
in the meantime, pinning
flask == 2.2.5helps.sskender commentedon May 8, 2023
Yeap, can confirm the same problem.
idoshr commentedon May 19, 2023
I think that this could be helpful
#537
EDIT:
This fork can be helpful
https://pypi.org/project/flask-mongoengine-3/
iammustafatz commentedon Jun 1, 2023
json_encoder and json_decoder attributes on app and blueprint, and the corresponding json.JSONEncoder and JSONDecoder classes, are removed from Flask version 2.3.0.
So, it shows JSONEncoder = json.JSONEncoder
AttributeError: module 'flask.json' has no attribute 'JSONEncoder'
For more refer: https://flask.palletsprojects.com/en/2.3.x/changes/#version-2-3-0
From pipenv change to portry, lock Flask in 2.2.5
From pipenv change to poetry, lock Flask in 2.2.5
📌 pin flask and Werkzeug
ruben-sprengel commentedon Oct 3, 2023
#537
rohank0510 commentedon Oct 20, 2023
downgrading to
flask==2.2.5worked for me! No longer getting this errorAudiosutras commentedon Mar 30, 2024
Is this a bug that will be fixed or are we to use @idoshr fork going forward. I think downgrading isn't the solution.