wget http://host/file.csv
# csv to json in python, requires a header row
cat file.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > file.json
cat file.json |jq
Created
April 12, 2023 09:44
-
-
Save bretton/7251f959dd29da6b8bb2fe71a901aa26 to your computer and use it in GitHub Desktop.
Bash and python one-liner to convert CSV to JSON
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment