while True:
my_dict={}
b = box.tolist()
t = np.array(timestamp).tolist()
my_dict["coordinates"] = b
my_dict["timestamp"]= t
all_dict.append(my_dict)
for my_dict in all_dict:
with open("co.json", 'a') as fp:
json.dump(my_dict,fp)
Output needs to be as json format, but it is not like this { {},{},{} }, it has just dump as {}{}{} without comma separator and without outer {}