Skip to content

Instantly share code, notes, and snippets.

@behumble
Created March 26, 2015 07:31
Show Gist options
  • Save behumble/de6bc0189d85edf197e7 to your computer and use it in GitHub Desktop.
Save behumble/de6bc0189d85edf197e7 to your computer and use it in GitHub Desktop.
flat key,value only (useful for i18n)
#!/usr/bin/env python
import sys
import json
import csv
reload(sys)
sys.setdefaultencoding('utf-8')
if len(sys.argv)<2:
print "json file name please"
sys.exit(1)
json_file = sys.argv[1]
json = json.loads(open(json_file).read())
csv_writer = csv.writer(open(json_file+'.csv', 'wb'))
for item in json.items():
csv_writer.writerow(item)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment