Skip to content

Instantly share code, notes, and snippets.

@alexlovelltroy
Created September 6, 2018 14:13
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 alexlovelltroy/5acf425dbd86ac13140d3e07ebcd262e to your computer and use it in GitHub Desktop.
Save alexlovelltroy/5acf425dbd86ac13140d3e07ebcd262e to your computer and use it in GitHub Desktop.
Given a son file, reformat it as one data element per line
#!/usr/bin/env python3
import json
import sys
if __name__ == "__main__":
program_name = sys.argv[0]
arguments = sys.argv[1:]
count = len(arguments)
filename = arguments[0]
with open(filename, 'r') as f:
members_dict = json.load(f)
with open(filename + "l", 'w', encoding='utf-8') as g:
for member in members_dict:
g.write(json.dumps(member)+'\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment