![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | wwave72 |
Hi, I’m having problems getting specific data from my JSON file, I already can get most of the items in the dictionary but the ones that have a int as reference don’t work correctly.
This is a portion of the JSON file
"hero0": {
"name": "Placeholder",
"inparty": true,
"level": 16,
"currentHP": 534,
"job1": 9,
"job2": 0,
"equipment": {
"righth": 1,
"lefth": 0,
"head": 0,
"armor": 0,
"ring1": 0,
"ring2": 0,
"amulet": 0
},
"joblevel": {
"0": 0,
"1": 4,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0
}
With the following code i can extract the ID of each equipment slot
var hero0EqHead
hero0JobData = ImportData.party_data["hero0"]["equipment"].head
Party data is my variable wih the JSON data but when I try the same as above but with a number at the end I get the following error.
hero0JobData = ImportData.party_data["hero0"]["joblevel"].1
error(117,61): Expected end of statement after expression, got Constant instead
I wanted to use integers to make a for loop to get all data from all “jobs” with a code that (if worked) looked like this
hero0JobData = ImportData.party_data["hero0"]["joblevel"].n
With “n” being the loop variable.
So, wrapping up. I want to get specific JSON data with a variable that correspond the ID of the item that I’m looking for.
I have tried reading the documentation but haven’t found anything useful, any help would be very appreciated