Skip to content

Instantly share code, notes, and snippets.

@mmaelzer
Created March 6, 2015 20:48
Show Gist options
  • Save mmaelzer/c989e7a94251c205799b to your computer and use it in GitHub Desktop.
Save mmaelzer/c989e7a94251c205799b to your computer and use it in GitHub Desktop.
csv_to_json.py
import csv
import json
import sys
jsonfile = open(sys.argv[2], 'w')
with open(sys.argv[1]) as csv_file:
reader = csv.DictReader(csv_file)
for row in reader:
json.dump(row, jsonfile)
jsonfile.write('\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment