Created
February 20, 2018 12:01
-
-
Save rockdaboot/efade2c7c5d777d94867977324779623 to your computer and use it in GitHub Desktop.
Convert CSV to JSON in two lines of code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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