Created
December 5, 2016 20:03
-
-
Save cmattoon/4fadd94f78e817214558802a5fe87224 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
Convert argv[1] from list (array) to dict (object) | |
""" | |
import sys, json | |
OUTFILE = 'test-output.json' | |
with open(sys.argv[1]) as fd: | |
data = json.loads(fd.read()) | |
new = {} | |
for obj in data: | |
new[ obj['url'] ] = { | |
'type': obj['type'], | |
'language': obj['language'], | |
'notes': obj['notes'] | |
} | |
with open(OUTFILE, 'wb') as fd: | |
json.dump(new, fd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment