import json

p = r"Responses\cache\mbpp-updated_corrected_50_ambiguous_0_aug.json"
ip = r"Responses\cache\1_mbpp-updated_corrected_50_ambiguous_0_aug.json"

with open(p, "r") as f:
    data = json.load(f)

# gen = []
# for d in data:
#     temp={}
#     temp['task_id'] = d['task_id']
#     temp['subtask_id'] = d['subtask_id']
#     temp['text'] = d['regenNL']
#     temp['info'] = d['info_examples']
#     temp['code'] = d['code']
#     temp['test_list'] = d['test_list']
#     gen.append(temp)

# with open(ip.replace("1_", "2_"), "w") as f:
#     json.dump(gen, f, indent=4)


gen = []
for d in data:
    temp={}
    temp['task_id'] = d['task_id']
    temp['subtask_id'] = d['subtask_id']
    temp['text'] = d['text']
    temp['info'] = d['info']
    temp['code'] = d['code']
    temp['test_list'] = d['updated_test_list']
    gen.append(temp)

with open(ip, "w") as f:
    json.dump(gen, f, indent=4)