I have a discord.py
bot and also a java discord bot that stores prefixes in a JSON file, I need a python script that adds or replaces the "prefix" value with python for a string that I already have. Here is a part of my JSON file:
{
"860550408350990376": {},
"894146731623735336": {},
"391919052563546112": {"dj_role_id": "613442662200246342"},
"825745065351577641": {"prefix": ";"},
"436822718067900417": {},
}
CodePudding user response:
import json
data = json.load(open('mydata.json'))
data["825734065351577641"]["prefix"] = '/'
json.dump(data, open('mydata.json','w')