Reputation: 45
I want to update only a part of data in this json file and im struggling to do it.
the json file is as follows:
[
{
"IP": "Not Specified",
"MOTD": "Not Specified",
"Seed": "Not Specified",
"Server_image": "Not Specified",
"Cracked_status": "Not Specified",
"Version": "Not Specified",
"Software": "Not Specified",
"Difficulty": "Not Specified"
}
]
I want to update the IP
value using python
Upvotes: 0
Views: 340
Reputation: 260
It's very simple. You can try this solution. I hope it will work for you.
list_name[0]["IP"] = "here will be the update value"
Upvotes: 2
Reputation: 860
the easy way to convert to dict modify and convert to JSON
import json
json_t = '[{"IP":"Not Specified","MOTD":"Not Specified","Seed":"Not Specified","Server_image":"Not Specified","Cracked_status":"Not Specified","Version":"Not Specified","Software":"Not Specified","Difficulty":"Not Specified"}]'
list_t = json.loads(json_t)
# modify the dict
json_t = json.dumps(list_t)
Upvotes: 0