with open(read_json,'r',encoding='utf-8') as json_file:
json_data = json.load(json_file)
with open(write_csv,'w',encoding='utf-8') as csv_file:
headers, items = parse_json(json_data,query_type)
# i is to be iterated to get all maxResults = 50.
writer = csv.writer(csv_file)
for row in items:
Windows applications often assume text files are encoded in an ANSI encoding, which varies by localized Windows version. Windows-1252 is the encoding used by U.S. Windows.
Excel also makes this assumption, but if it sees a UTF8 BOM signature, it will use UTF8 for the encoding. Use the file encoding
utf-8-sig to write this signature. If used to open a file for reading, it recognizes and discards the signature so it doesn't affect your Python code.
utf-8-sig instead to give Excel the hint it needs.