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
keywords must be strings #11
Comments
@emmanuelito Sorry for the long response. from flask import Flask
from flask import jsonify
app = Flask('xxx')
flask_json.FlaskJSON(app)
app.config['JSON_USE_ENCODE_METHODS'] = True
class MyJsonItem(object):
def __json__(self):
return '<__json__>'
def for_json(self):
return '<for_json>'
with app.test_request_context('/fake'):
r = jsonify(MyJsonItem())
assert r.json == '<__json__>' |
@skozlovf thank you ! I understand now the source of the problem. |
I'll think about it. I planned to update internals to follow new Flask 2.3 API and will improve stuff to handle this case. Let's keep the issue open. |
Highlights: * Allow both data_ and kwargs. * Add numeric keys support (see #11).
Fixed/improved in |
Python's JSON encoder allow integer as keys (and convert them as strings), but not flask-json.
This is a problem when one wants to replace Flask's default JSON encoder by FlaskJSON.
The text was updated successfully, but these errors were encountered: