How do I go about returning json data from a bottle request handler. I see a dict2json method in the bottle src but I am not sure how to use it.
What is in the documentation:
@route('/spam')
def spam():
return {'status':'online', 'servertime':time.time()}
Gives me this when I bring up the page:
<html>
<head></head>
<body>statusservertime</body>
</html>
Simply return a dict. Bottle handles the conversion to JSON for you.
Taken from the documentation.
http://bottlepy.org/docs/stable/api.html#the-bottle-class