import csv,json
from pathlib import Path
p=Path(__file__).parent
expected=json.loads((p/'depth-input.json').read_text(encoding='utf-8'))
with (p/'depth-output.csv').open(encoding='utf-8',newline='') as f:
    actual=[{'id':r['id'],'payload':json.loads(r['payload_json'])} for r in csv.DictReader(f)]
assert actual==expected
print('Original two records and nested strings match exactly.')
