Change JSON API to use Flask's jsonify function.