Hi, I’m a beginner, I’ve spent a day trying to use CSV or JSON kind of file to give input to change some values in my game. My thought is if I can convert below JSON file to a nested dictionary/List and then I can use a dictionary/List for updating the values. But this JSON file and its data struct are too complex for me.
Attached below is the JSON file.
“Player” represents a GameObject that has speedIncrease variable, Regular A, B, C D represents GameObject has members, Amount, Probability, CanAtStart, and AtEndOnly. Eventually, I want when the level is 1, I use 1’s data to update the Player and RegularX GameObject member’s value, and when it’s 2 use 2’s data to update them etc.
The question is how the nested dictionary/List should look like and how can I convert this JSON file to be?
"1": {
"Player": {
"SpeedIncrease": 1
},
"RegularA": {
"Amount": 1,
"Probability": 1,
"CanAtStart": "",
"AtEndOnly": ""
},
"RegularB": {
"Amount": 1,
"Probability": 1,
"CanAtStart": "",
"AtEndOnly": ""
},
"RegularC": {
"Amount": 1,
"Probability": 1,
"CanAtStart": "",
"AtEndOnly": ""
},
"RegularD": {
"Amount": 1,
"Probability": 1,
"CanAtStart": "",
"AtEndOnly": ""
}
},
"2": {
"Player": {
"SpeedIncrease": 1
},
"RegularA": {
"Amount": 1,
"Probability": 1,
"CanAtStart": "",
"AtEndOnly": ""
},
"RegularB": {
"Amount": 1,
"Probability": 2,
"CanAtStart": "",
"AtEndOnly": ""
},
"RegularC": {
"Amount": 1,
"Probability": 1,
"CanAtStart": "",
"AtEndOnly": ""
},
"RegularD": {
"Amount": 1,
"Probability": 1,
"CanAtStart": "",
"AtEndOnly": ""
}
},
3: {
..........```