1 import json
2 import csv
3
4 # JSONファイルを読み込む
5 with open('data.json', 'r') as f:
6 # 空欄A
7 json_data = _______________
8
9 # JSONデータの最初の要素からフィールド名を取得
10 fieldnames = json_data[0].keys()
11
12 # CSVファイルに書き込む
13 with open('output.csv', 'w', newline='') as csvfile:
14 writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
15 # 空欄B
16 _______________
17
18 # データを書き込む
19 for row in json_data:
20 writer.writerow(row)
21
22 print("変換が完了しました!")