Each time I use jsonify
, I get the JSON keys sorted alphabetically. I don't want the keys sorted. Can I disable the sorting done in jsonify
?
from flask import request, jsonify
@app.route('/', methods=['POST'])
def index():
json_dict = request.get_json()
user_id = json_dict['user_id']
permissions = json_dict['permissions']
data = {'user_id': user_id, 'permissions': permissions}
return jsonify(data)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…