I have a JSON object that contains several game object arrays (e.g. heroes, enemies, weapons, buildings, etc). I'm new to JSON, so I feel like what I need to do is easy and I'm just missing it.
Basically, I want to say "find the building where the .objectName key = "weaponsmith" and return the value of the .tooltip key for that same building". Since the buildings are in an array, I can't just use JSON.Get() right off the bat because I don't know which index (e.g. .buildings.1, .buildings.2, etc) the "weaponsmith" is.
I don't want to have to do a For Each loop through the entire building array for each building on the map (unless this is the only way to do it?).
So, I think what I'm looking for is a JSON.IndexOf("") expression, which doesn't exist. Can anyone clear up how to do this or perhaps point out if I'm going about this incorrectly? Thank you.
EDIT
I thought of loading just the Building data into an Array object so I could use Array.IndexOf. However, the Array > Load from JSON action isn't doing anything when I feed it ObjectData.GetAsCompactString("objects.buildings"). Where ObjectData is the name of my JSON object. I verified the JSON string output is correct/valid. When I say it isn't doing anything, I mean the Array remains the default 10x1 array initialized to 0 after the Load from JSON action.
So, question #2: How can you get a subset of a JSON object into an Array? C3 manual entries for JSON and Array don't address this specifically.