I need to show an output like below as a result of a webservice call
{
  "predictions": [
    {
      "id": 18009,
      "cuisine": "italian",
      "probability": 0.17846838753494407
    },
    {
      "id": 28583,
      "cuisine": "italian",
      "probability": 0.1918703125538735
    }
  ]
}
I have the below code to create the object:
    json_data = []
    for i in range (0, len(predicted_labels)):
        data = {}
        data['id'] = int(test['id'][i])
        data['cuisine'] = categoricalTransformer[predicted_labels[i]]
        item = predicted_probability[i]
        data['probability'] = item[predicted_labels[i]]
        json_data.append(data)
    json_return = {"predictions":json_data}
    return jsonify(json_return)
which reorders the key alphabetically as shown below.
{
  "predictions": [
    {
      "cuisine": "italian",
      "id": 18009,
      "probability": 0.17846838753494407
    },
    {
      "cuisine": "italian",
      "id": 28583,
      "probability": 0.1918703125538735
    }
  ]
}
What should I do?
 
     
    