Returning a JSON array in bottle involves setting the response content type to application/json
and then manually dumping the array using json.dumps()
:
#!/usr/bin/env python3 from bottle import route, run, response import json @route('/') def json_array(): response.content_type = 'application/json' return json.dumps(["a", "b", "c"]) run(host='localhost', port=9000)