I can read the json file and set the information I need to the variables. I have accounts, and I need to be able to add an account to it, this is the code I have so far:
import json
user = raw_input("User: ")
with open('text.json') as data_file:
data = json.load(data_file)
code = data["users"][user]["pass"]
display = data["users"][user]["display"]
print "Password: " + code
print "Display Name - " + display
This works fine to read the file, here is the expected format of the output json file:
{
"users":{
"User1": {
"display": "User1",
"pass": "EzPass123"
},
"Richard": {
"display": "Attack69",
"pass": "Smith"
}
}
}
Can someone show me how to add another account to the accounts already existing in the dictionary?