How to send a JSON response.
Last updated 4 years ago
Use the respond() function (or the deprecated respond keyword) to return JSON data. This will also include the 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)