import csv,json
from pathlib import Path
source=json.loads(Path('gzip-input.json').read_text(encoding='utf-8'))
with open('new-output.csv',encoding='utf-8',newline='') as f:rows=list(csv.reader(f,strict=True))
if not rows or rows[0]!=['id','note']:raise ValueError('unexpected header')
rebuilt=[]
for row in rows[1:]:
    if len(row)!=2:raise ValueError('unexpected width')
    rebuilt.append(dict(zip(rows[0],row,strict=True)))
if rebuilt!=source:raise ValueError('record values changed')
print('Original records and strings match.')
