I'm trying to append objects to an array with the following code
model_array = [model 1, model 2, model 3] json_array = [] model_data = {} X = len(model_array) Y = 0 while Y != X: model_data["label"] = 'Model No' model_data["value"] = model_array[Y] json_array.append(model_data) Y = Y + 1 print(json_array)The output of the json_array is
Output:{
label : Model No
value : model 3
}
{
label : Model No
value : model 3
}
{
label : Model No
value : model 3
}
Can anybody tell me why the json_array only lists model 3 and not the other models