Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flask2.3.X JSONEncoder deprecated #522

Open
uamrws opened this issue Apr 28, 2023 · 7 comments
Open

Flask2.3.X JSONEncoder deprecated #522

uamrws opened this issue Apr 28, 2023 · 7 comments

Comments

@uamrws
Copy link

uamrws commented Apr 28, 2023

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'

@jrypel
Copy link

jrypel commented May 7, 2023

in the meantime, pinning flask == 2.2.5 helps.

@sskender
Copy link

sskender commented May 8, 2023

Yeap, can confirm the same problem.

@idoshr
Copy link
Contributor

idoshr commented 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
Copy link

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

denny0223 added a commit to CCIP-App/CCIP-Server that referenced this issue Jun 28, 2023
denny0223 added a commit to CCIP-App/CCIP-Server that referenced this issue Jun 28, 2023
bunop added a commit to cnr-ibba/SMARTER-backend that referenced this issue Sep 18, 2023
flask-mongoengine and flask-restful have issues with flask and werkzeug latest release. See flask-restful/flask-restful#936 and MongoEngine/flask-mongoengine#522
@ruben-sprengel
Copy link

#537

@rohank0510
Copy link

rohank0510 commented Oct 20, 2023

downgrading to flask==2.2.5 worked for me! No longer getting this error

@Audiosutras
Copy link

Is this a bug that will be fixed or are we to use @idoshr fork going forward. I think downgrading isn't the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants