Skip to content

Instantly share code, notes, and snippets.

@rockdaboot
Created February 20, 2018 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockdaboot/efade2c7c5d777d94867977324779623 to your computer and use it in GitHub Desktop.
Save rockdaboot/efade2c7c5d777d94867977324779623 to your computer and use it in GitHub Desktop.
Convert CSV to JSON in two lines of code
import sys
import csv
import json
if __name__=="__main__":
reader = csv.DictReader(sys.stdin)
sys.stdout.write(json.dumps([r for r in reader], sort_keys=False, indent=4, separators=(',', ': ')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment