How to send a JSON response.
Use the respond() function (or the deprecated respond keyword) to return JSON data. This will also include the HTTP status code 200 OK.
respond()
respond
respond(...)
Any datatype than can be JSON serialized:
dictionary.
list.
string.
integer.
float.
boolean.
tuple.
@get('/greet/<name>'): respond('Hello ' + name)
Last updated 4 years ago