Ok my turn.
I store the json file with decode. Then I parse into dictionary. I can get the value of the nested key like this.
Variable = gameDictionary["gameName"]["mapSearch"]["coordinates"]["Xstart"]
Now I want to do like the author and write the values back to the file!
I'm trying to use dict put but can't figure out the syntax. I tried using gameDictionary with just the Xstart key but that didn't work. Next I tried the total path as above and without the dictionary name.
gameDictionary["gameName"]["mapSearch"]["coordinates"]["Xstart"]
["gameName"]["mapSearch"]["coordinates"]["Xstart"]
Those didn't work either. How do I set the dictionary value for the nested Xstart key? I want these values stored in the json file afterwards. Which means I will then have reformat the dictionary back to the json text!
My json file contents:
{
"gameName": {
"appData": {
"Display Name": "gameDisplayName",
"Package Name": "gamePackageName",
"Version Name": "gameVersionCodeNumberName",
"Version Code": "gameVersionCodeNumber",
"Cache Size": "gameVersionCacheSize",
"Data Size": "gameDataSize",
"Code Size": "gameCodeSize",
"Apk Paths": "arrApkPathsrrApkPaths"
},
"mapSearch": {
"coordinates": {
"Xstart": 0,
"Ystart": 1200,
"Xend": 1200,
"Yend": 0,
"gridWidthPerRow": 300