JSON zu CSV
# call csvkit (which is a Python tool) to convert json to csv:
# https://csvkit.readthedocs.io/en/latest/
in2csv data.json > data.csv
Troubled Tapir
# call csvkit (which is a Python tool) to convert json to csv:
# https://csvkit.readthedocs.io/en/latest/
in2csv data.json > data.csv
python -c "import csv,json;print json.dumps(list(csv.reader(open('csv_file.csv'))))"
import json
if __name__ == '__main__':
try:
with open('input.json', 'r') as f:
data = json.loads(f.read())
output = ','.join([*data[0]])
for obj in data:
output += f'\n{obj["Name"]},{obj["age"]},{obj["birthyear"]}'
with open('output.csv', 'w') as f:
f.write(output)
except Exception as ex:
print(f'Error: {str(ex)}')