time = [0 1 2 3....]
result = ['normal','limp'....]
def create_dict(a_number):
return {'Time': time[a_number],
'Reusult of this person': result[a_number]}
n = 0
final_dict = []
while n < len(time):
dict = create_dict(n)
final_dict.append(dict)
n = n + 1
json_file = json.dumps(final_dict)
with open("sample.json", "w") as outfile:
outfile.write(json_file)
I created n dictionary within a while loop then append them together, after generating json file, the dict in this file look as one long row,([{"Time": "0 seconds to 2", "Reusult of this person": "limp"}, {"Time": "1 seconds to 3", "Reusult of this person": "normal"}, {"Time": "2 secon) how to change it vertically? origin json file