I'm trying to use Swagger to build an API using Python and Connexion. I want to generate UTF-8 encoded JSON output but I get a \u escaped sequence like this in my responses:
euro \u20ac
instead of this:
euro €
I'm already specifying the charset for the endpoint, maybe I'm missing other Swagger setting in the specification regarding marshalling:
produces:
- "application/json; charset=utf-8"
and the response header is correctly returning the content type:
HTTP/1.0 200 OK
Content-Type: application/json; charset=utf-8
I also tried to add this to the generated "swagger_server/__main__.py
" with same results:
app.app.json_encoder = encoder.JSONEncoder
app.app.json_encoder.ensure_ascii = False
app.app.json_encoder.encoding="utf-8"
Edit: Here's my requirements.txt. The one generated by SwaggerEditor doesn't work on Ubuntu 18.04 with Python 3.6.9, it requires connexion == 1.1.15 but it fails with ImportError: cannot import name 'FileStorage'. It would be great for somebody to give a correct one. By now I just need Connexion and its dependencies:
connexion == 2.4.0
python_dateutil == 2.6.0
setuptools >= 21.0.0
How can I achieve it? Thanks!!