atc_mithermometer_gateway/log_to_json.py

14 lines
243 B
Python

import json
with open('history.txt', 'r') as file:
content = file.readlines()
lines = []
for line in content:
line = json.loads(line.strip())
lines.append(line)
with open('history.json', 'w') as file:
file.write(json.dumps(lines))