Untitled
unknown
python
19 days ago
412 B
9
Indexable
Never
jsonData = json.load(response.json()) jsonItems = jsonData['data']['beverageDescriptionCollection']['items'] with open('beverageDescriptionCollection.csv', 'w', newline='') as csvFile: fieldNames = jsonItems[0].keys() writer = csv.writer(csvFile) writer.writerow(fieldNames) for jsonItem in jsonItems: writer.writerow(jsonItems.values()) csvFile.close()
Leave a Comment