import json with open("fixtures/merger.json", "r") as f: text = f.read() # Fix the broken formatting text = text.replace("'{',\n \" {timestamp}\",\n \" }'", "'{{timestamp}}'") text = text.replace("'{',\n \" {uuid}\",\n \" }'", "'{{uuid}}'") text = text.replace("'{',\n \" {uuid:person_id}\",\n \" }'", "'{{uuid:person_id}}'") text = text.replace("'{',\n \" {uuid:order_id}\",\n \" }'", "'{{uuid:order_id}}'") text = text.replace("'{',\n \" {uuid:line1_id}\",\n \" }'", "'{{uuid:line1_id}}'") text = text.replace("'{',\n \" {uuid:line2_id}\",\n \" }'", "'{{uuid:line2_id}}'") with open("fixtures/merger.json", "w") as f: f.write(text)