pgjones · GitHub

@pgjones

@pgjones pgjones changed the title WIP: Allow dictionaries return values as JSON Allow dictionaries return values as JSON

Mar 10, 2019

@pgjones

This supports an increasingly common usecase whereby JSON is the
primary response (rather than a templated string). Given Flask has a
short syntax for HTML reponses, it seems fitting that it should also
do so for JSON responses. In practice it allows,
     @app.route("/")
     def index():
         return {
             "api_stuff": "values",
         }

@davidism

@davidism

davidism

@davidism

Closed

Merged

lafrech added a commit to marshmallow-code/flask-smorest that referenced this pull request

Sep 16, 2019

Merged

Open

rtzll added a commit to rtzll/flask-todolist that referenced this pull request

Jul 17, 2020
Since Flask 1.1.0 returning a dict will lead to responding with json by
default.
See: pallets/flask#3111

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators

Nov 14, 2020

Read the original on github.com ↗