Skip to content

Instantly share code, notes, and snippets.

@ShaneRich5
Last active August 17, 2017 14:46
Show Gist options
  • Save ShaneRich5/d53c90e834dc05cbd49065b10a9bf182 to your computer and use it in GitHub Desktop.
Save ShaneRich5/d53c90e834dc05cbd49065b10a9bf182 to your computer and use it in GitHub Desktop.
import os
import json
from pprint import pprint
for filename in os.listdir('./'):
if (filename.endswith('.json')):
with open(filename, 'r') as json_file:
data = json.load(json_file)
if (data['email'] != data['username']):
with open(filename, 'w') as json_file:
print data['email']
data['username'] = data['email']
json.dump(data, json_file, indent=2, sort_keys=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment